This repository has been archived on 2024-02-08. You can view files and clone it, but cannot push or open issues or pull requests.
2022-02-13 18:57:12 +00:00
|
|
|
/**
|
|
|
|
* Make date objects from timestamps
|
2022-08-02 13:19:51 +00:00
|
|
|
*/
|
2022-10-17 11:14:07 +00:00
|
|
|
export function parseDateOrNull(date: string | Date) {
|
2021-07-05 10:29:04 +00:00
|
|
|
if (date instanceof Date) {
|
|
|
|
return date
|
|
|
|
}
|
|
|
|
|
2022-10-17 11:14:07 +00:00
|
|
|
if ((typeof date === 'string') && !date.startsWith('0001')) {
|
2021-02-21 15:13:58 +00:00
|
|
|
return new Date(date)
|
|
|
|
}
|
2022-08-02 13:19:51 +00:00
|
|
|
|
2021-02-21 15:13:58 +00:00
|
|
|
return null
|
|
|
|
}
|