From bd4aaede5d2ded84f14c50ed56533ea1618eafb2 Mon Sep 17 00:00:00 2001 From: "Leon.Schmidt" Date: Thu, 6 Aug 2026 18:31:00 +0200 Subject: [PATCH] ADD - normalize database timestamps --- frontend/src/utils/date.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 frontend/src/utils/date.ts diff --git a/frontend/src/utils/date.ts b/frontend/src/utils/date.ts new file mode 100644 index 0000000..38a49b9 --- /dev/null +++ b/frontend/src/utils/date.ts @@ -0,0 +1,10 @@ +export type DatabaseDateValue = string | number + +export function parseDatabaseDate(value: DatabaseDateValue): Date { + if (typeof value === 'number') { + const timestamp = Math.abs(value) < 1_000_000_000_000 ? value * 1000 : value + return new Date(timestamp) + } + + return new Date(value.replace(' ', 'T')) +}