fix: update date format when switching language
This commit is contained in:
parent
e3ab850cc1
commit
0c069e4809
|
@ -5,7 +5,7 @@ export const useFormattedDateTime = (
|
||||||
options: Intl.DateTimeFormatOptions = { dateStyle: 'long', timeStyle: 'medium' },
|
options: Intl.DateTimeFormatOptions = { dateStyle: 'long', timeStyle: 'medium' },
|
||||||
) => {
|
) => {
|
||||||
const { locale } = useI18n()
|
const { locale } = useI18n()
|
||||||
const formatter = Intl.DateTimeFormat(locale.value, options)
|
const formatter = $computed(() => Intl.DateTimeFormat(locale.value, options))
|
||||||
return computed(() => {
|
return computed(() => {
|
||||||
const v = resolveUnref(value)
|
const v = resolveUnref(value)
|
||||||
return v ? formatter.format(new Date(v)) : ''
|
return v ? formatter.format(new Date(v)) : ''
|
||||||
|
|
Loading…
Reference in a new issue