diff --git a/packages/twenty-front/src/modules/ui/input/components/internal/date/components/DatePicker.tsx b/packages/twenty-front/src/modules/ui/input/components/internal/date/components/DatePicker.tsx index 08e824802c6..4b12b878977 100644 --- a/packages/twenty-front/src/modules/ui/input/components/internal/date/components/DatePicker.tsx +++ b/packages/twenty-front/src/modules/ui/input/components/internal/date/components/DatePicker.tsx @@ -21,6 +21,7 @@ import { Temporal } from 'temporal-polyfill'; import { type Nullable } from 'twenty-shared/types'; import { isDefined, + parseToPlainDateOrThrow, turnJSDateToPlainDate, type RelativeDateFilter, } from 'twenty-shared/utils'; @@ -356,7 +357,7 @@ export const DatePicker = ({ }: DatePickerProps) => { const { theme } = useContext(ThemeContext); const plainDate = isDefined(plainDateString) - ? Temporal.PlainDate.from(plainDateString) + ? parseToPlainDateOrThrow(plainDateString) : Temporal.Now.plainDateISO(); const { userTimezone } = useUserTimezone(); diff --git a/packages/twenty-front/src/modules/ui/input/components/internal/date/components/DatePickerWithoutCalendar.tsx b/packages/twenty-front/src/modules/ui/input/components/internal/date/components/DatePickerWithoutCalendar.tsx index fa13744512d..7dcf4727756 100644 --- a/packages/twenty-front/src/modules/ui/input/components/internal/date/components/DatePickerWithoutCalendar.tsx +++ b/packages/twenty-front/src/modules/ui/input/components/internal/date/components/DatePickerWithoutCalendar.tsx @@ -15,7 +15,11 @@ import 'react-datepicker/dist/react-datepicker.css'; import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import { Temporal } from 'temporal-polyfill'; import { type Nullable } from 'twenty-shared/types'; -import { isDefined, turnJSDateToPlainDate } from 'twenty-shared/utils'; +import { + isDefined, + parseToPlainDateOrThrow, + turnJSDateToPlainDate, +} from 'twenty-shared/utils'; import { ThemeContext, themeCssVariables } from 'twenty-ui/theme-constants'; export const MONTH_AND_YEAR_DROPDOWN_MONTH_SELECT_ID = @@ -323,7 +327,7 @@ export const DatePickerWithoutCalendar = ({ onClose, }: DatePickerWithoutCalendarProps) => { const { theme } = useContext(ThemeContext); - const plainDate = isDefined(date) ? Temporal.PlainDate.from(date) : null; + const plainDate = isDefined(date) ? parseToPlainDateOrThrow(date) : null; const { closeDropdown: closeDropdownMonthSelect } = useCloseDropdown(); const { closeDropdown: closeDropdownYearSelect } = useCloseDropdown();