Files
sky_phone/frontend/src/utils/date.ts
T
2026-08-06 18:31:00 +02:00

11 lines
314 B
TypeScript

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'))
}