mobilizon.chapril.org-mobil.../js/src/plugins/dateFns.ts
Thomas Citharel 93cecbe49c
Improve build times
* Fix bulma/buefy being imported many (many !!!) times

* Remove javascript-time-ago because date-fns pretty much does the same
thing

* Make sure languages are loaded asynchronously

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
2020-10-14 09:46:33 +02:00

15 lines
381 B
TypeScript

import Locale from "date-fns";
import VueInstance from "vue";
declare module "vue/types/vue" {
interface Vue {
$dateFnsLocale: Locale;
}
}
export function DateFnsPlugin(vue: typeof VueInstance, { locale }: { locale: string }): void {
import(`date-fns/locale/${locale}/index.js`).then((localeEntity) => {
VueInstance.prototype.$dateFnsLocale = localeEntity;
});
}