mirror of
https://github.com/mealie-recipes/mealie.git
synced 2025-11-11 14:32:33 -05:00
fix: Locale dates format (#6211)
Co-authored-by: Michael Genson <71845777+michael-genson@users.noreply.github.com>
This commit is contained in:
@@ -165,7 +165,7 @@
|
|||||||
>
|
>
|
||||||
<template #activator="{ props: activatorProps }">
|
<template #activator="{ props: activatorProps }">
|
||||||
<v-text-field
|
<v-text-field
|
||||||
v-model="field.value"
|
:model-value="field.value ? $d(new Date(field.value + 'T00:00:00')) : null"
|
||||||
persistent-hint
|
persistent-hint
|
||||||
:prepend-icon="$globals.icons.calendar"
|
:prepend-icon="$globals.icons.calendar"
|
||||||
variant="underlined"
|
variant="underlined"
|
||||||
|
|||||||
@@ -55,7 +55,7 @@
|
|||||||
>
|
>
|
||||||
<template #activator="{ props: activatorProps }">
|
<template #activator="{ props: activatorProps }">
|
||||||
<v-text-field
|
<v-text-field
|
||||||
v-model="newMealdateString"
|
:model-value="$d(newMealdate)"
|
||||||
:label="$t('general.date')"
|
:label="$t('general.date')"
|
||||||
:prepend-icon="$globals.icons.calendar"
|
:prepend-icon="$globals.icons.calendar"
|
||||||
v-bind="activatorProps"
|
v-bind="activatorProps"
|
||||||
|
|||||||
@@ -57,7 +57,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<template #[`item.dateAdded`]="{ item }">
|
<template #[`item.dateAdded`]="{ item }">
|
||||||
{{ formatDate(item.dateAdded!) }}
|
{{ item.dateAdded ? $d(new Date(item.dateAdded)) : '' }}
|
||||||
</template>
|
</template>
|
||||||
</v-data-table>
|
</v-data-table>
|
||||||
</template>
|
</template>
|
||||||
@@ -153,15 +153,6 @@ const headers = computed(() => {
|
|||||||
return hdrs;
|
return hdrs;
|
||||||
});
|
});
|
||||||
|
|
||||||
function formatDate(date: string) {
|
|
||||||
try {
|
|
||||||
return i18n.d(Date.parse(date), "medium");
|
|
||||||
}
|
|
||||||
catch {
|
|
||||||
return "";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// ============
|
// ============
|
||||||
// Group Members
|
// Group Members
|
||||||
const api = useUserApi();
|
const api = useUserApi();
|
||||||
|
|||||||
@@ -16,7 +16,7 @@
|
|||||||
>
|
>
|
||||||
<template #activator="{ props: activatorProps }">
|
<template #activator="{ props: activatorProps }">
|
||||||
<v-text-field
|
<v-text-field
|
||||||
v-model="expirationDateString"
|
:model-value="$d(expirationDate)"
|
||||||
:label="$t('recipe-share.expiration-date')"
|
:label="$t('recipe-share.expiration-date')"
|
||||||
:hint="$t('recipe-share.default-30-days')"
|
:hint="$t('recipe-share.default-30-days')"
|
||||||
persistent-hint
|
persistent-hint
|
||||||
@@ -59,11 +59,8 @@
|
|||||||
|
|
||||||
<div class="pl-3 flex-grow-1">
|
<div class="pl-3 flex-grow-1">
|
||||||
<v-list-item-title>
|
<v-list-item-title>
|
||||||
{{ $t("recipe-share.expires-at") }}
|
{{ $t("recipe-share.expires-at") + ' ' + $d(new Date(token.expiresAt!), "short") }}
|
||||||
</v-list-item-title>
|
</v-list-item-title>
|
||||||
<v-list-item-subtitle>
|
|
||||||
{{ $d(new Date(token.expiresAt!), "long") }}
|
|
||||||
</v-list-item-subtitle>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<v-btn
|
<v-btn
|
||||||
@@ -111,10 +108,6 @@ const datePickerMenu = ref(false);
|
|||||||
const expirationDate = ref(new Date(Date.now() - new Date().getTimezoneOffset() * 60000));
|
const expirationDate = ref(new Date(Date.now() - new Date().getTimezoneOffset() * 60000));
|
||||||
const tokens = ref<RecipeShareToken[]>([]);
|
const tokens = ref<RecipeShareToken[]>([]);
|
||||||
|
|
||||||
const expirationDateString = computed(() => {
|
|
||||||
return expirationDate.value.toISOString().substring(0, 10);
|
|
||||||
});
|
|
||||||
|
|
||||||
whenever(
|
whenever(
|
||||||
() => dialog.value,
|
() => dialog.value,
|
||||||
() => {
|
() => {
|
||||||
|
|||||||
@@ -32,7 +32,7 @@
|
|||||||
>
|
>
|
||||||
<template #activator="{ props: activatorProps }">
|
<template #activator="{ props: activatorProps }">
|
||||||
<v-text-field
|
<v-text-field
|
||||||
v-model="newTimelineEventTimestampString"
|
:model-value="$d(newTimelineEventTimestamp)"
|
||||||
:prepend-icon="$globals.icons.calendar"
|
:prepend-icon="$globals.icons.calendar"
|
||||||
v-bind="activatorProps"
|
v-bind="activatorProps"
|
||||||
readonly
|
readonly
|
||||||
@@ -102,7 +102,7 @@
|
|||||||
<span class="text-body-1 opacity-80">
|
<span class="text-body-1 opacity-80">
|
||||||
<b>{{ $t("general.last-made") }}</b>
|
<b>{{ $t("general.last-made") }}</b>
|
||||||
<br>
|
<br>
|
||||||
{{ lastMade ? new Date(lastMade).toLocaleDateString($i18n.locale) : $t("general.never") }}
|
{{ lastMade ? $d(new Date(lastMade)) : $t("general.never") }}
|
||||||
</span>
|
</span>
|
||||||
<v-icon end size="large" color="primary">
|
<v-icon end size="large" color="primary">
|
||||||
{{ $globals.icons.createAlt }}
|
{{ $globals.icons.createAlt }}
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
<v-icon class="mr-1">
|
<v-icon class="mr-1">
|
||||||
{{ $globals.icons.calendar }}
|
{{ $globals.icons.calendar }}
|
||||||
</v-icon>
|
</v-icon>
|
||||||
{{ new Date(event.timestamp).toLocaleDateString($i18n.locale) }}
|
{{ $d(new Date(event.timestamp)) }}
|
||||||
</v-chip>
|
</v-chip>
|
||||||
</template>
|
</template>
|
||||||
<v-card
|
<v-card
|
||||||
@@ -22,7 +22,7 @@
|
|||||||
<v-col v-if="useMobileFormat" align-self="center" class="pr-0">
|
<v-col v-if="useMobileFormat" align-self="center" class="pr-0">
|
||||||
<v-chip label>
|
<v-chip label>
|
||||||
<v-icon> {{ $globals.icons.calendar }} </v-icon>
|
<v-icon> {{ $globals.icons.calendar }} </v-icon>
|
||||||
{{ new Date(event.timestamp || "").toLocaleDateString($i18n.locale) }}
|
{{ $d(new Date(event.timestamp || "")) }}
|
||||||
</v-chip>
|
</v-chip>
|
||||||
</v-col>
|
</v-col>
|
||||||
<v-col v-else cols="9" style="margin: auto; text-align: center">
|
<v-col v-else cols="9" style="margin: auto; text-align: center">
|
||||||
|
|||||||
@@ -130,9 +130,8 @@
|
|||||||
<v-col cols="auto">
|
<v-col cols="auto">
|
||||||
<div class="text-caption font-weight-light font-italic">
|
<div class="text-caption font-weight-light font-italic">
|
||||||
{{ $t("shopping-list.completed-on", {
|
{{ $t("shopping-list.completed-on", {
|
||||||
date: new Date(listItem.updatedAt
|
date: listItem.updatedAt ? $d(new Date(listItem.updatedAt)) : '',
|
||||||
|| "").toLocaleDateString($i18n.locale) })
|
}) }}
|
||||||
}}
|
|
||||||
</div>
|
</div>
|
||||||
</v-col>
|
</v-col>
|
||||||
</v-row>
|
</v-row>
|
||||||
|
|||||||
@@ -106,7 +106,7 @@
|
|||||||
@click:row="setSelected"
|
@click:row="setSelected"
|
||||||
>
|
>
|
||||||
<template #[`item.date`]="{ item }">
|
<template #[`item.date`]="{ item }">
|
||||||
{{ $d(Date.parse(item.date), "medium") }}
|
{{ $d(Date.parse(item.date)) }}
|
||||||
</template>
|
</template>
|
||||||
<template #[`item.actions`]="{ item }">
|
<template #[`item.actions`]="{ item }">
|
||||||
<v-btn
|
<v-btn
|
||||||
|
|||||||
@@ -324,7 +324,7 @@
|
|||||||
</v-icon>
|
</v-icon>
|
||||||
</template>
|
</template>
|
||||||
<template #[`item.createdAt`]="{ item }">
|
<template #[`item.createdAt`]="{ item }">
|
||||||
{{ formatDate(item.createdAt) }}
|
{{ item.createdAt ? $d(new Date(item.createdAt)) : '' }}
|
||||||
</template>
|
</template>
|
||||||
<template #button-bottom>
|
<template #button-bottom>
|
||||||
<BaseButton @click="seedDialog = true">
|
<BaseButton @click="seedDialog = true">
|
||||||
@@ -417,15 +417,6 @@ export default defineNuxtComponent({
|
|||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
function formatDate(date: string) {
|
|
||||||
try {
|
|
||||||
return i18n.d(Date.parse(date), "medium");
|
|
||||||
}
|
|
||||||
catch {
|
|
||||||
return "";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const userHousehold = computed(() => $auth.user.value?.householdSlug || "");
|
const userHousehold = computed(() => $auth.user.value?.householdSlug || "");
|
||||||
const foodStore = useFoodStore();
|
const foodStore = useFoodStore();
|
||||||
const foods = computed(() => foodStore.store.value.map((food) => {
|
const foods = computed(() => foodStore.store.value.map((food) => {
|
||||||
@@ -634,7 +625,6 @@ export default defineNuxtComponent({
|
|||||||
foods,
|
foods,
|
||||||
allLabels,
|
allLabels,
|
||||||
validators,
|
validators,
|
||||||
formatDate,
|
|
||||||
// Create
|
// Create
|
||||||
createDialog,
|
createDialog,
|
||||||
domNewFoodForm,
|
domNewFoodForm,
|
||||||
|
|||||||
@@ -292,7 +292,7 @@
|
|||||||
</v-icon>
|
</v-icon>
|
||||||
</template>
|
</template>
|
||||||
<template #[`item.createdAt`]="{ item }">
|
<template #[`item.createdAt`]="{ item }">
|
||||||
{{ formatDate(item.createdAt) }}
|
{{ item.createdAt ? $d(new Date(item.createdAt)) : '' }}
|
||||||
</template>
|
</template>
|
||||||
<template #button-bottom>
|
<template #button-bottom>
|
||||||
<BaseButton @click="seedDialog = true">
|
<BaseButton @click="seedDialog = true">
|
||||||
@@ -381,15 +381,6 @@ export default defineNuxtComponent({
|
|||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
function formatDate(date: string) {
|
|
||||||
try {
|
|
||||||
return i18n.d(Date.parse(date), "medium");
|
|
||||||
}
|
|
||||||
catch {
|
|
||||||
return "";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const { store, actions: unitActions } = useUnitStore();
|
const { store, actions: unitActions } = useUnitStore();
|
||||||
|
|
||||||
// ============================================================
|
// ============================================================
|
||||||
@@ -545,7 +536,6 @@ export default defineNuxtComponent({
|
|||||||
tableHeaders,
|
tableHeaders,
|
||||||
store,
|
store,
|
||||||
validators,
|
validators,
|
||||||
formatDate,
|
|
||||||
// Create
|
// Create
|
||||||
createDialog,
|
createDialog,
|
||||||
domNewUnitForm,
|
domNewUnitForm,
|
||||||
|
|||||||
@@ -33,9 +33,8 @@
|
|||||||
>
|
>
|
||||||
<template #activator="{ props }">
|
<template #activator="{ props }">
|
||||||
<v-text-field
|
<v-text-field
|
||||||
v-model="newMealDateString"
|
:model-value="$d(newMeal.date)"
|
||||||
:label="$t('general.date')"
|
:label="$t('general.date')"
|
||||||
:hint="$t('recipe.date-format-hint-yyyy-mm-dd')"
|
|
||||||
persistent-hint
|
persistent-hint
|
||||||
:prepend-icon="$globals.icons.calendar"
|
:prepend-icon="$globals.icons.calendar"
|
||||||
v-bind="props"
|
v-bind="props"
|
||||||
|
|||||||
Reference in New Issue
Block a user