From e5602551c5c5ce91313bcfd522b735b608a54755 Mon Sep 17 00:00:00 2001 From: AlexSserb Date: Sun, 24 Aug 2025 14:54:10 +0400 Subject: [PATCH] feat: datetimes with timezones --- openapi-ts.config.ts | 4 +++- package.json | 2 ++ .../DealEditorDrawer/components/GeneralTab.tsx | 10 +++++++--- src/lib/client/types.gen.ts | 4 ++++ src/lib/client/zod.gen.ts | 3 +++ src/utils/datetime.ts | 16 ++++++++++++++++ yarn.lock | 18 ++++++++++++++++++ 7 files changed, 53 insertions(+), 4 deletions(-) create mode 100644 src/utils/datetime.ts diff --git a/openapi-ts.config.ts b/openapi-ts.config.ts index f050910..8654c3e 100644 --- a/openapi-ts.config.ts +++ b/openapi-ts.config.ts @@ -11,9 +11,11 @@ export default defineConfig({ { name: "zod", requests: true, - responses: true, definitions: true, metadata: true, + dates: { + offset: true, + }, }, { name: "@hey-api/sdk", diff --git a/package.json b/package.json index 3ac6e38..2b27f39 100644 --- a/package.json +++ b/package.json @@ -25,6 +25,8 @@ "@tanstack/react-query": "^5.83.0", "axios": "^1.11.0", "classnames": "^2.5.1", + "date-fns": "^4.1.0", + "date-fns-tz": "^3.2.0", "framer-motion": "^12.23.7", "i18n-iso-countries": "^7.14.0", "lexorank": "^1.0.5", diff --git a/src/app/deals/drawers/DealEditorDrawer/components/GeneralTab.tsx b/src/app/deals/drawers/DealEditorDrawer/components/GeneralTab.tsx index fafc4e6..bee81fd 100644 --- a/src/app/deals/drawers/DealEditorDrawer/components/GeneralTab.tsx +++ b/src/app/deals/drawers/DealEditorDrawer/components/GeneralTab.tsx @@ -1,9 +1,10 @@ import { FC, useState } from "react"; import { isEqual } from "lodash"; -import { Button, Group, Stack, TextInput } from "@mantine/core"; +import { Button, Group, Stack, Text, TextInput } from "@mantine/core"; import { useForm } from "@mantine/form"; import { DealsCrud } from "@/hooks/cruds/useDealsCrud"; import { DealSchema } from "@/lib/client"; +import { utcDateTimeToLocalString } from "@/utils/datetime"; type Props = { dealsCrud: DealsCrud; @@ -36,8 +37,11 @@ const GeneralTab: FC = ({ deal, dealsCrud, onClose }) => { label={"Название"} {...form.getInputProps("name")} /> - - + Создано: {utcDateTimeToLocalString(deal.createdAt)} + +