forked from Mirrors/elk
fix: formatted edited time
This commit is contained in:
parent
cedb511681
commit
c4af4a610e
2 changed files with 3 additions and 3 deletions
|
@ -6,8 +6,8 @@ const { status } = defineProps<{
|
||||||
inline: boolean
|
inline: boolean
|
||||||
}>()
|
}>()
|
||||||
|
|
||||||
const editedAt = $computed(() => status.editedAt)
|
const editedAt = computed(() => status.editedAt)
|
||||||
const formatted = useFormattedDateTime(status.editedAt)
|
const formatted = useFormattedDateTime(editedAt)
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import type { MaybeComputedRef, UseTimeAgoOptions } from '@vueuse/core'
|
import type { MaybeComputedRef, UseTimeAgoOptions } from '@vueuse/core'
|
||||||
|
|
||||||
export const useFormattedDateTime = (
|
export const useFormattedDateTime = (
|
||||||
value: MaybeComputedRef<string | Date | undefined>,
|
value: MaybeComputedRef<string | Date | undefined | null>,
|
||||||
options: Intl.DateTimeFormatOptions = { dateStyle: 'long', timeStyle: 'medium' },
|
options: Intl.DateTimeFormatOptions = { dateStyle: 'long', timeStyle: 'medium' },
|
||||||
) => {
|
) => {
|
||||||
const formatter = Intl.DateTimeFormat(undefined, options)
|
const formatter = Intl.DateTimeFormat(undefined, options)
|
||||||
|
|
Loading…
Reference in a new issue