mirror of
https://github.com/sky-systems/sky_phone.git
synced 2026-08-29 01:08:59 +00:00
ADD - normalize database timestamps
This commit is contained in:
@@ -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'))
|
||||
}
|
||||
Reference in New Issue
Block a user