Skip to content

Commit

Permalink
Merge branch 'main' into review-status-bug
Browse files Browse the repository at this point in the history
  • Loading branch information
ibolton336 authored Jan 3, 2024
2 parents 414863d + 34ffd17 commit 971f463
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -222,9 +222,13 @@ export const WaveForm: React.FC<WaveFormProps> = ({
});

const startDateStr = watch("startDateStr");
const endDateStr = watch("endDateStr");
const startDate = dateStrFormatValidator(startDateStr)
? dayjs(startDateStr).toDate()
: null;
const endDate = dateStrFormatValidator(endDateStr)
? dayjs(endDateStr).toDate()
: null;

const onSubmit = (formValues: WaveFormValues) => {
const stakeholders =
Expand Down Expand Up @@ -315,7 +319,7 @@ export const WaveForm: React.FC<WaveFormProps> = ({
aria-label={name}
onChange={(e, val) => {
onChange(val);
trigger("endDateStr");
if (endDate) trigger("endDateStr");
}}
placeholder="MM/DD/YYYY"
value={value}
Expand Down Expand Up @@ -356,6 +360,7 @@ export const WaveForm: React.FC<WaveFormProps> = ({
dateFormat={(val) => dayjs(val).format("MM/DD/YYYY")}
dateParse={(val) => dayjs(val).toDate()}
validators={[endDateRangeValidator]}
rangeStart={startDate ? startDate : undefined}
appendTo={() => endDateRef.current || document.body}
/>
)}
Expand Down

0 comments on commit 971f463

Please sign in to comment.