From f2e899864341dae499c2ce8ceb876603c026762a Mon Sep 17 00:00:00 2001 From: Jackson Hyde Date: Wed, 19 Feb 2025 14:24:55 +0000 Subject: [PATCH] From and arrival dates --- src/components/Pax/PaxSearchForm/PaxSearchForm.tsx | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/components/Pax/PaxSearchForm/PaxSearchForm.tsx b/src/components/Pax/PaxSearchForm/PaxSearchForm.tsx index aa93185..772b7be 100644 --- a/src/components/Pax/PaxSearchForm/PaxSearchForm.tsx +++ b/src/components/Pax/PaxSearchForm/PaxSearchForm.tsx @@ -48,7 +48,6 @@ export const PaxSearchForm = ({day, time, arrivalDate, fromDate, toDate, timeMac toDate: moment(toDate) || moment(), timeMachine: timeMachine || false, }); - const [disabledTo, setDisableTo] = React.useState(false); const handleOnChangeCallback = (payload: PaxSearchFormState) => { onChange && onChange({ @@ -75,7 +74,9 @@ export const PaxSearchForm = ({day, time, arrivalDate, fromDate, toDate, timeMac const newState = { ...formState, day: newValue, - arrivalDate + arrivalDate, + fromDate: arrivalDate.clone().set('hour', fromDate.get('hours')).set('minute', fromDate.get('hours')), + toDate: arrivalDate.clone().set('hour', toDate.get('hours')).set('minute', toDate.get('hours')), } setFormState(newState); handleOnChangeCallback(newState); @@ -86,11 +87,9 @@ export const PaxSearchForm = ({day, time, arrivalDate, fromDate, toDate, timeMac switch (newValue) { case '24hour': toDate = moment().add(24, 'hours'); - setDisableTo(true); break; default: toDate = moment() - setDisableTo(false); break; } const newState = { @@ -144,6 +143,7 @@ export const PaxSearchForm = ({day, time, arrivalDate, fromDate, toDate, timeMac handleDatepickerChange('arrivalDate', value)} /> @@ -154,7 +154,7 @@ export const PaxSearchForm = ({day, time, arrivalDate, fromDate, toDate, timeMac onChange={(value) => handleDatepickerChange('fromDate', value)} /> handleDatepickerChange('toDate', value)}