diff --git a/src/helpers/time/formatDate.js b/src/helpers/time/formatDate.js index c3e8c1b7..afa3f70a 100644 --- a/src/helpers/time/formatDate.js +++ b/src/helpers/time/formatDate.js @@ -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) : '' +} diff --git a/src/main.ts b/src/main.ts index 552e5c3d..b4ed880a 100644 --- a/src/main.ts +++ b/src/main.ts @@ -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'