Fix the date-time picker broken after MUI5 upgrade.

This commit is contained in:
Yogesh Mahajan 2024-04-23 17:03:34 +05:30 committed by GitHub
parent 84c024f6fa
commit 673b5ea5a1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -268,8 +268,12 @@ export function InputDateTimePicker({ value, onChange, readonly, controlProps, .
placeholder = controlProps.placeholder || 'YYYY-MM-DD HH:mm:ss Z';
}
const handleChange = (dateVal, stringVal) => {
onChange(stringVal);
const handleChange = (dateVal) => {
if(DateFns.isValid(dateVal)) {
onChange(DateFns.format(dateVal, format));
} else{
onChange(null);
}
};
/* Value should be a date object instead of string */