first step towards localized meal date

This commit is contained in:
Florian Dupret 2021-02-22 19:55:23 +01:00
commit b9982c07f8
3 changed files with 23 additions and 4 deletions

View file

@ -17,7 +17,7 @@
:src="getImage(meal.slug)"
@click="openSearch(index)"
></v-img>
<v-card-title class="my-n3 mb-n6">{{ meal.dateText }}</v-card-title>
<v-card-title class="my-n3 mb-n6">{{ $d( new Date(meal.date), 'short' ) }}</v-card-title>
<v-card-subtitle> {{ meal.name }}</v-card-subtitle>
</v-card>
</v-hover>

View file

@ -20,8 +20,27 @@ function loadLocaleMessages() {
return messages;
}
const dateTimeFormats = {
'en': {
short: {
month: 'short',
day: 'numeric',
weekday: 'long'
},
},
'fr': {
short: {
month: 'short',
day: 'numeric',
weekday: 'long'
}
}
}
export default new VueI18n({
locale: "en",
fallbackLocale: process.env.VUE_APP_I18N_FALLBACK_LOCALE || "en",
messages: loadLocaleMessages(),
dateTimeFormats
});

View file

@ -25,8 +25,8 @@
>
<v-card class="mt-1">
<v-card-title>
{{ formatDate(mealplan.startDate) }} -
{{ formatDate(mealplan.endDate) }}
{{ $d( new Date(mealplan.startDate), 'short' ) }} -
{{ $d( new Date(mealplan.endDate), 'short' ) }}
</v-card-title>
<v-list nav>
<v-list-item-group color="primary">
@ -43,7 +43,7 @@
</v-list-item-avatar>
<v-list-item-content>
<v-list-item-title v-text="meal.name"></v-list-item-title>
<v-list-item-subtitle v-text="meal.dateText">
<v-list-item-subtitle v-text="$d( new Date(meal.date), 'short' )" >
</v-list-item-subtitle>
</v-list-item-content>
</v-list-item>