mirror of
https://github.com/go-vikunja/vikunja.git
synced 2026-05-06 19:47:47 -05:00
fix: properly parse dates or null
Resolves https://kolaente.dev/vikunja/frontend/issues/2214
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user