fix: properly parse dates or null
continuous-integration/drone/push Build is passing Details

Resolves #2214
This commit is contained in:
kolaente 2022-08-02 15:19:51 +02:00
parent 31480eae72
commit e82a83c8cf
Signed by: konrad
GPG Key ID: F40E70337AB24C9B
1 changed files with 3 additions and 2 deletions

View File

@ -1,13 +1,14 @@
/**
* Make date objects from timestamps
*/
*/
export function parseDateOrNull(date) {
if (date instanceof Date) {
return date
}
if (date && !date.startsWith('0001')) {
if ((typeof date === 'string' || date instanceof String) && !date.startsWith('0001')) {
return new Date(date)
}
return null
}