diff --git a/src/helpers/parseDateOrNull.ts b/src/helpers/parseDateOrNull.ts index 656e36df..836b3040 100644 --- a/src/helpers/parseDateOrNull.ts +++ b/src/helpers/parseDateOrNull.ts @@ -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 }