From 8d6401018c1c349af3b4725b1d86a20b4f3a12c3 Mon Sep 17 00:00:00 2001 From: Allan Carr Date: Mon, 19 Aug 2024 10:29:46 -0700 Subject: [PATCH] IO-2834 Time Picker Correction Signed-off-by: Allan Carr --- .../form-date-time-picker.component.jsx | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/client/src/components/form-date-time-picker/form-date-time-picker.component.jsx b/client/src/components/form-date-time-picker/form-date-time-picker.component.jsx index 23af7008a..49abaaad6 100644 --- a/client/src/components/form-date-time-picker/form-date-time-picker.component.jsx +++ b/client/src/components/form-date-time-picker/form-date-time-picker.component.jsx @@ -7,11 +7,12 @@ import FormDatePicker from "../form-date-picker/form-date-picker.component"; //To be used as a form element only. const DateTimePicker = ({ value, onChange, onBlur, id, onlyFuture, ...restProps }, ref) => { - // const handleChange = (newDate) => { - // if (value !== newDate && onChange) { - // onChange(newDate); - // } - // }; + const handleDateChange = (date) => { + const newValue = date ? dayjs(date).set('hour', dayjs().hour()).set('minute', dayjs().minute()) : null; + if (onChange) { + onChange(newValue); + } + }; return ( @@ -22,7 +23,7 @@ const DateTimePicker = ({ value, onChange, onBlur, id, onlyFuture, ...restProps })} value={value} onBlur={onBlur} - onChange={onChange} + onChange={handleDateChange} onlyFuture={onlyFuture} isDateOnly={false} />