feat(status): add edit indicator for detail

This commit is contained in:
三咲智子 2022-11-26 11:36:18 +08:00
parent 0ada9e0448
commit d146b5b730
No known key found for this signature in database
GPG key ID: 69992F2250DFD93E
5 changed files with 30 additions and 9 deletions

View file

@ -1,9 +1,12 @@
import type { MaybeRef } from '@vueuse/core'
export const useFormattedDateTime = (
value: MaybeRef<string | Date>,
value: MaybeRef<string | Date | undefined>,
options: Intl.DateTimeFormatOptions = { dateStyle: 'long', timeStyle: 'medium' },
) => {
const formatter = Intl.DateTimeFormat(undefined, options)
return computed(() => formatter.format(new Date(resolveUnref(value))))
return computed(() => {
const v = resolveUnref(value)
return v ? formatter.format(new Date(v)) : ''
})
}