Skip to content

Commit

Permalink
🐛 Allow current date wave start date (#1587)
Browse files Browse the repository at this point in the history
  • Loading branch information
ibolton336 authored Dec 6, 2023
1 parent 5b9531f commit 789434f
Showing 1 changed file with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -256,9 +256,13 @@ export const WaveForm: React.FC<WaveFormProps> = ({
};

const startDateRangeValidator = (date: Date) => {
if (date < dayjs().toDate()) {
return "Date is before allowable range.";
const selectedDate = dayjs(date);
const currentDate = dayjs();

if (selectedDate.isBefore(currentDate, "day")) {
return "Start date cannot be in the past.";
}

return "";
};

Expand Down Expand Up @@ -341,7 +345,6 @@ export const WaveForm: React.FC<WaveFormProps> = ({
dateParse={(val) => dayjs(val).toDate()}
validators={[endDateRangeValidator]}
appendTo={() => document.body}
isDisabled={!!formErrors.startDateStr}
/>
)}
/>
Expand Down

0 comments on commit 789434f

Please sign in to comment.