diff --git a/packages/core/src/widgets/datetime/DateTimeControl.tsx b/packages/core/src/widgets/datetime/DateTimeControl.tsx index 0246354d..c3c03305 100644 --- a/packages/core/src/widgets/datetime/DateTimeControl.tsx +++ b/packages/core/src/widgets/datetime/DateTimeControl.tsx @@ -82,7 +82,14 @@ const DateTimeControl: FC> = ({ return valueToParse; } - return storageFormat ? parse(valueToParse, storageFormat, new Date()) : parseISO(valueToParse); + if (storageFormat) { + const parsed = parse(valueToParse, storageFormat, new Date()); + // if parsing fails, Invalid Date (NaN) will be returned: fallback to parseISO + if (!isNaN(parsed.getTime())) { + return parsed; + } + } + return parseISO(valueToParse); }, [defaultValue, storageFormat, internalValue]); const handleChange = useCallback(