From db494001a26a1493f3d2be436186babbf6913e50 Mon Sep 17 00:00:00 2001 From: Tomazed Date: Mon, 30 Jan 2023 15:17:04 +0100 Subject: [PATCH] Import all locales from date-fns/locale --- client/plugins/init.client.js | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/client/plugins/init.client.js b/client/plugins/init.client.js index 5908165c..553d9b2e 100644 --- a/client/plugins/init.client.js +++ b/client/plugins/init.client.js @@ -2,24 +2,14 @@ import Vue from 'vue' import Path from 'path' import vClickOutside from 'v-click-outside' import { formatDistance, format, addDays, isDate, setDefaultOptions } from 'date-fns' -import { de as localeDE, enUS as localeENUS, es as localeES, fr as localeFR, hr as localeHR, it as localeIT, pl as localePL, zhCN as localeZNCN } from 'date-fns/locale' -let locale = { - de: localeDE, - enUS: localeENUS, - es: localeES, - fr: localeFR, - hr: localeHR, - it: localeIT, - pl: localePL, - znCN: localeZNCN -} +import * as locale from 'date-fns/locale' Vue.directive('click-outside', vClickOutside.directive) Vue.prototype.$setDateFnsLocale = (localeString) => { if (!locale[localeString]) return 0 - return setDefaultOptions({locale: locale[localeString]}) + return setDefaultOptions({ locale: locale[localeString] }) } Vue.prototype.$dateDistanceFromNow = (unixms) => { if (!unixms) return ''