fix: formatted edited time

zio/stable
三咲智子 2022-11-27 16:48:04 +08:00
parent cedb511681
commit c4af4a610e
No known key found for this signature in database
GPG Key ID: 69992F2250DFD93E
2 changed files with 3 additions and 3 deletions

View File

@ -6,8 +6,8 @@ const { status } = defineProps<{
inline: boolean
}>()
const editedAt = $computed(() => status.editedAt)
const formatted = useFormattedDateTime(status.editedAt)
const editedAt = computed(() => status.editedAt)
const formatted = useFormattedDateTime(editedAt)
</script>
<template>

View File

@ -1,7 +1,7 @@
import type { MaybeComputedRef, UseTimeAgoOptions } from '@vueuse/core'
export const useFormattedDateTime = (
value: MaybeComputedRef<string | Date | undefined>,
value: MaybeComputedRef<string | Date | undefined | null>,
options: Intl.DateTimeFormatOptions = { dateStyle: 'long', timeStyle: 'medium' },
) => {
const formatter = Intl.DateTimeFormat(undefined, options)