fix: don't try to format invalid dates as ISO
This commit is contained in:
parent
2e77df2db2
commit
50c3bcd793
2 changed files with 6 additions and 3 deletions
|
@ -1,5 +1,5 @@
|
|||
import {createDateFromString} from '@/helpers/time/createDateFromString'
|
||||
import {format, formatDistanceToNow} from 'date-fns'
|
||||
import {format, formatDistanceToNow, formatISO as formatISOfns} from 'date-fns'
|
||||
import {enGB, de, fr, ru} from 'date-fns/locale'
|
||||
|
||||
import {i18n} from '@/i18n'
|
||||
|
@ -44,3 +44,7 @@ export const formatDateSince = (date) => {
|
|||
addSuffix: true,
|
||||
})
|
||||
}
|
||||
|
||||
export function formatISO(date) {
|
||||
return date ? formatISOfns(date) : ''
|
||||
}
|
||||
|
|
|
@ -18,8 +18,7 @@ declare global {
|
|||
}
|
||||
}
|
||||
|
||||
import {formatDate, formatDateShort, formatDateLong, formatDateSince} from '@/helpers/time/formatDate'
|
||||
import {formatISO} from 'date-fns'
|
||||
import {formatDate, formatDateShort, formatDateLong, formatDateSince, formatISO} from '@/helpers/time/formatDate'
|
||||
// @ts-ignore
|
||||
import {VERSION} from './version.json'
|
||||
|
||||
|
|
Loading…
Reference in a new issue