From 71d0815891b40ff1857312fa9ea39b4b31e284ff Mon Sep 17 00:00:00 2001 From: Maksim Eltyshev Date: Sat, 16 Nov 2024 18:13:13 +0100 Subject: [PATCH] fix: Consider language specifics when parsing time Closes #946 --- .../DueDateEditStep/DueDateEditStep.jsx | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/client/src/components/DueDateEditStep/DueDateEditStep.jsx b/client/src/components/DueDateEditStep/DueDateEditStep.jsx index 9c9c1f3b..530e85db 100755 --- a/client/src/components/DueDateEditStep/DueDateEditStep.jsx +++ b/client/src/components/DueDateEditStep/DueDateEditStep.jsx @@ -67,11 +67,18 @@ const DueDateEditStep = React.memo(({ defaultValue, onUpdate, onBack, onClose }) return; } - const value = parseTime(data.time, nullableDate); + let value = t('format:dateTime', { + postProcess: 'parseDate', + value: `${data.date} ${data.time}`, + }); if (Number.isNaN(value.getTime())) { - timeField.current.select(); - return; + value = parseTime(data.time, nullableDate); + + if (Number.isNaN(value.getTime())) { + timeField.current.select(); + return; + } } if (!defaultValue || value.getTime() !== defaultValue.getTime()) { @@ -79,7 +86,7 @@ const DueDateEditStep = React.memo(({ defaultValue, onUpdate, onBack, onClose }) } onClose(); - }, [defaultValue, onUpdate, onClose, data, nullableDate]); + }, [defaultValue, onUpdate, onClose, data, nullableDate, t]); const handleClearClick = useCallback(() => { if (defaultValue) {