fix: update date format when switching language

zio/stable
三咲智子 2022-12-01 21:14:58 +08:00
parent e3ab850cc1
commit 0c069e4809
No known key found for this signature in database
GPG Key ID: 69992F2250DFD93E
1 changed files with 1 additions and 1 deletions

View File

@ -5,7 +5,7 @@ export const useFormattedDateTime = (
options: Intl.DateTimeFormatOptions = { dateStyle: 'long', timeStyle: 'medium' },
) => {
const { locale } = useI18n()
const formatter = Intl.DateTimeFormat(locale.value, options)
const formatter = $computed(() => Intl.DateTimeFormat(locale.value, options))
return computed(() => {
const v = resolveUnref(value)
return v ? formatter.format(new Date(v)) : ''