From 34ffd17790d2496b95b577da0de7165f38c5d247 Mon Sep 17 00:00:00 2001 From: Ian Bolton Date: Wed, 3 Jan 2024 17:17:47 -0500 Subject: [PATCH] :bug: Add range styles and remove initial validation for end date (#1651) https://issues.redhat.com/browse/MTA-1871 Signed-off-by: ibolton336 --- .../migration-waves/components/migration-wave-form.tsx | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/client/src/app/pages/migration-waves/components/migration-wave-form.tsx b/client/src/app/pages/migration-waves/components/migration-wave-form.tsx index a7983cada..2b098417c 100644 --- a/client/src/app/pages/migration-waves/components/migration-wave-form.tsx +++ b/client/src/app/pages/migration-waves/components/migration-wave-form.tsx @@ -222,9 +222,13 @@ export const WaveForm: React.FC = ({ }); 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 = @@ -315,7 +319,7 @@ export const WaveForm: React.FC = ({ aria-label={name} onChange={(e, val) => { onChange(val); - trigger("endDateStr"); + if (endDate) trigger("endDateStr"); }} placeholder="MM/DD/YYYY" value={value} @@ -356,6 +360,7 @@ export const WaveForm: React.FC = ({ dateFormat={(val) => dayjs(val).format("MM/DD/YYYY")} dateParse={(val) => dayjs(val).toDate()} validators={[endDateRangeValidator]} + rangeStart={startDate ? startDate : undefined} appendTo={() => endDateRef.current || document.body} /> )}