vikunja-frontend/src/helpers/parseDateOrNull.ts
2022-04-02 17:17:09 +02:00

13 lines
214 B
TypeScript

/**
* Make date objects from timestamps
*/
export function parseDateOrNull(date) {
if (date instanceof Date) {
return date
}
if (date && !date.startsWith('0001')) {
return new Date(date)
}
return null
}