This commit is contained in:
James Cole 2021-09-25 06:31:12 +02:00
parent 138b60c462
commit dd7344d05d
No known key found for this signature in database
GPG Key ID: BDE6667570EADBD5

View File

@ -92,17 +92,33 @@
</span> </span>
</template> </template>
<template #cell(start_date)="data"> <template #cell(start_date)="data">
{{ formatDate(new Date(data.item.date.substring(0, 10)), $t('config.month_and_day_fns')) }} {{
new Intl.DateTimeFormat(locale, {
year: 'numeric',
month: 'long',
day: 'numeric'
}).format(new Date(data.item.date.substring(0, 10)))
}}
</template> </template>
<template #cell(end_date)="data"> <template #cell(end_date)="data">
<span v-if="null !== data.item.end_date">{{ <span v-if="null !== data.item.end_date">
formatDate(new Date(data.item.end_date.substring(0, 10)), $t('config.month_and_day_fns')) {{
}}</span> new Intl.DateTimeFormat(locale, {
year: 'numeric',
month: 'long',
day: 'numeric'
}).format(new Date(data.item.end_date.substring(0, 10)))
}}
</span>
<span v-if="null === data.item.end_date">{{ $t('firefly.forever') }}</span> <span v-if="null === data.item.end_date">{{ $t('firefly.forever') }}</span>
<span v-if="null !== data.item.extension_date"><br/> <span v-if="null !== data.item.extension_date"><br/>
<small> <small>
{{ {{
$t('firefly.extension_date_is', {date: formatDate(new Date(data.item.extension_date.substring(0, 10)), $t('config.month_and_day_fns'))}) $t('firefly.extension_date_is', {date: new Intl.DateTimeFormat(locale, {
year: 'numeric',
month: 'long',
day: 'numeric'
}).format(new Date(data.item.extension_date.substring(0, 10)))})
}} }}
</small> </small>
</span> </span>
@ -179,6 +195,7 @@ import {mapGetters, mapMutations} from "vuex";
import {configureAxios} from "../../shared/forageStore"; import {configureAxios} from "../../shared/forageStore";
import format from "date-fns/format"; import format from "date-fns/format";
export default { export default {
name: "Index", name: "Index",
data() { data() {
@ -189,6 +206,7 @@ export default {
locale: 'en-US', locale: 'en-US',
sortedGroups: [], sortedGroups: [],
fields: [], fields: [],
fnsLocale: null
} }
}, },
computed: { computed: {
@ -196,13 +214,15 @@ export default {
}, },
created() { created() {
this.locale = localStorage.locale ?? 'en-US'; this.locale = localStorage.locale ?? 'en-US';
console.log(this.locale);
this.updateFieldList(); this.updateFieldList();
this.downloadBills(1); this.downloadBills(1);
}, },
methods: { methods: {
...mapMutations('root', ['refreshCacheKey',]), ...mapMutations('root', ['refreshCacheKey',]),
formatDate: function (date, frm) { formatDate: function (date, frm) {
return format(date, frm); return format(date, frm, {locale: {code: this.locale}});
}, },
updateFieldList: function () { updateFieldList: function () {
this.fields = []; this.fields = [];