1
0
Fork 1
mirror of https://github.com/elk-zone/elk.git synced 2024-11-04 16:09:59 +00:00

fix: formatted edited time

This commit is contained in:
三咲智子 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)