1
0
Fork 0
mirror of https://github.com/plankanban/planka.git synced 2025-07-24 07:39:44 +02:00

fix: Format-agnostic time parsing

Closes #916
This commit is contained in:
Maksim Eltyshev 2024-10-21 14:11:26 +02:00
parent 16eb1823e1
commit 3eb488ce61
2 changed files with 105 additions and 5 deletions

View file

@ -7,6 +7,7 @@ import { useDidUpdate, useToggle } from '../../lib/hooks';
import { Input, Popup } from '../../lib/custom-ui';
import { useForm } from '../../hooks';
import parseTime from '../../utils/parse-time';
import styles from './DueDateEditStep.module.scss';
@ -66,10 +67,7 @@ const DueDateEditStep = React.memo(({ defaultValue, onUpdate, onBack, onClose })
return;
}
const value = t('format:dateTime', {
postProcess: 'parseDate',
value: `${data.date} ${data.time}`,
});
const value = parseTime(data.time, nullableDate);
if (Number.isNaN(value.getTime())) {
timeField.current.select();
@ -81,7 +79,7 @@ const DueDateEditStep = React.memo(({ defaultValue, onUpdate, onBack, onClose })
}
onClose();
}, [defaultValue, onUpdate, onClose, data, nullableDate, t]);
}, [defaultValue, onUpdate, onClose, data, nullableDate]);
const handleClearClick = useCallback(() => {
if (defaultValue) {