From 27f27f4c38a5b662bf13bf1e9eb18430ee7c042d Mon Sep 17 00:00:00 2001 From: admin Date: Thu, 18 Sep 2025 16:24:39 +0300 Subject: [PATCH] feat: update CardAttributeField to handle date values without timezone --- .../components/CardAttributeField.tsx | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/components/CardAttributeFields/components/CardAttributeField.tsx b/src/components/CardAttributeFields/components/CardAttributeField.tsx index bce7515..c1fd281 100644 --- a/src/components/CardAttributeFields/components/CardAttributeField.tsx +++ b/src/components/CardAttributeFields/components/CardAttributeField.tsx @@ -4,6 +4,7 @@ import { UseFormReturnType } from "@mantine/form"; import { DatePickerInput, DateTimePicker } from "@mantine/dates"; import { CardGeneralFormType } from "../../../pages/CardsPage/drawers/CardEditDrawer/tabs/GeneralTab/GeneralTab.tsx"; import { IconInfoCircle } from "@tabler/icons-react"; +import { dateWithoutTimezone } from "../../../shared/lib/date.ts"; type Props = { attribute: AttributeSchema; @@ -45,6 +46,15 @@ const CardAttributeField = ({ attribute, form, readOnly }: Props) => { { + if (!value) { + form.getInputProps(attribute.name).onChange(null); + return + } + form.getInputProps(attribute.name).onChange( + dateWithoutTimezone(value), + ); + }} value={getDateValue()} clearable locale={"ru-RU"} @@ -58,6 +68,15 @@ const CardAttributeField = ({ attribute, form, readOnly }: Props) => { { + if (!value) { + form.getInputProps(attribute.name).onChange(null); + return + } + form.getInputProps(attribute.name).onChange( + dateWithoutTimezone(value), + ); + }} value={getDateValue()} clearable locale={"ru-RU"}