diff --git a/src/helpers/parseDateOrNull.ts b/src/helpers/parseDateOrNull.ts index 656e36dfcc..836b3040d7 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 }