2020-08-05 11:42:23 +02:00
|
|
|
import Locale from "date-fns";
|
2020-10-13 20:39:59 +02:00
|
|
|
import VueInstance from "vue";
|
2020-08-05 11:42:23 +02:00
|
|
|
|
|
|
|
declare module "vue/types/vue" {
|
|
|
|
interface Vue {
|
|
|
|
$dateFnsLocale: Locale;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-10-13 20:39:59 +02:00
|
|
|
export function DateFnsPlugin(vue: typeof VueInstance, { locale }: { locale: string }): void {
|
2020-08-05 11:42:23 +02:00
|
|
|
import(`date-fns/locale/${locale}/index.js`).then((localeEntity) => {
|
2020-10-13 20:39:59 +02:00
|
|
|
VueInstance.prototype.$dateFnsLocale = localeEntity;
|
2020-08-05 11:42:23 +02:00
|
|
|
});
|
|
|
|
}
|