mirror of
https://github.com/go-vikunja/vikunja.git
synced 2026-04-30 16:28:23 -05:00
15 lines
253 B
TypeScript
15 lines
253 B
TypeScript
/**
|
|
* Make date objects from timestamps
|
|
*/
|
|
export function parseDateOrNull(date: string | Date) {
|
|
if (date instanceof Date) {
|
|
return date
|
|
}
|
|
|
|
if ((typeof date === 'string') && !date.startsWith('0001')) {
|
|
return new Date(date)
|
|
}
|
|
|
|
return null
|
|
}
|