diff --git a/web/pgadmin/static/js/components/FormComponents.jsx b/web/pgadmin/static/js/components/FormComponents.jsx index e52a7a2c9..740ac0d25 100644 --- a/web/pgadmin/static/js/components/FormComponents.jsx +++ b/web/pgadmin/static/js/components/FormComponents.jsx @@ -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 */