Skip to content

Commit b2589b1

Browse files
authored
feat(DateTime): add locale support for i18n date formatting (#206)
1 parent c8a7a5d commit b2589b1

1 file changed

Lines changed: 11 additions & 1 deletion

File tree

app/components/DateTime.vue

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ const props = withDefaults(
2929
},
3030
)
3131
32+
const { locale } = useI18n()
33+
3234
const relativeDates = useRelativeDates()
3335
3436
// Compute the title - always show full date for accessibility
@@ -41,7 +43,13 @@ const titleValue = computed(() => {
4143

4244
<template>
4345
<ClientOnly>
44-
<NuxtTime v-if="relativeDates" :datetime="datetime" :title="titleValue" relative />
46+
<NuxtTime
47+
v-if="relativeDates"
48+
:datetime="datetime"
49+
:title="titleValue"
50+
relative
51+
:locale="locale"
52+
/>
4553
<NuxtTime
4654
v-else
4755
:datetime="datetime"
@@ -50,6 +58,7 @@ const titleValue = computed(() => {
5058
:year="year"
5159
:month="month"
5260
:day="day"
61+
:locale="locale"
5362
/>
5463
<template #fallback>
5564
<NuxtTime
@@ -59,6 +68,7 @@ const titleValue = computed(() => {
5968
:year="year"
6069
:month="month"
6170
:day="day"
71+
:locale="locale"
6272
/>
6373
</template>
6474
</ClientOnly>

0 commit comments

Comments
 (0)