Add const lang = require(flatpickr/dist/l10n/${this.locale}.js).default[this.locale];

This commit is contained in:
Steven Brauer 2021-02-13 19:37:17 +01:00 committed by GitHub
parent 9270e12976
commit 0abb35c2e8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -27,8 +27,6 @@
<script>
import flatPicker from "vue-flatpickr-component";
import "flatpickr/dist/flatpickr.css";
import { de } from 'flatpickr/dist/l10n/de.js';
import { en } from 'flatpickr/dist/l10n/default.js';
export default {
name: 'akaunting-date',
@ -73,13 +71,23 @@ export default {
icon: {
type: String,
description: "Prepend icon (left)"
},
locale: {
type: String,
default: 'en',
}
},
data() {
return {
real_model: this.model,
locale: !this.local ? de : en,
}
},
created() {
if (this.locale !== 'en') {
const lang = require(`flatpickr/dist/l10n/${this.locale}.js`).default[this.locale];
this.config.locale = lang;
}
},