diff --git a/components/status/StatusCard.vue b/components/status/StatusCard.vue index 207468a0..81af3578 100644 --- a/components/status/StatusCard.vue +++ b/components/status/StatusCard.vue @@ -90,7 +90,7 @@ const timeago = useTimeAgo(() => status.createdAt, { - + diff --git a/components/status/StatusDetails.vue b/components/status/StatusDetails.vue index 08510df7..0a9fda0e 100644 --- a/components/status/StatusDetails.vue +++ b/components/status/StatusDetails.vue @@ -11,7 +11,7 @@ const status = $computed(() => { return props.status }) -const date = useFormattedDateTime(status.createdAt) +const createdAt = useFormattedDateTime(status.createdAt) const visibility = $computed(() => STATUS_VISIBILITIES.find(v => v.value === status.visibility)!) @@ -31,7 +31,10 @@ const visibility = $computed(() => STATUS_VISIBILITIES.find(v => v.value === sta />
-
{{ date }}
+
+
{{ createdAt }}
+ +
ยท
diff --git a/components/status/StatusEditIndicator.vue b/components/status/StatusEditIndicator.vue index 98de2a90..69fc5243 100644 --- a/components/status/StatusEditIndicator.vue +++ b/components/status/StatusEditIndicator.vue @@ -1,11 +1,20 @@ diff --git a/composables/masto.ts b/composables/masto.ts index e9e36660..fc319a94 100644 --- a/composables/masto.ts +++ b/composables/masto.ts @@ -1,6 +1,12 @@ import type { Ref } from 'vue' import type { Account, Relationship, Status } from 'masto' +declare module 'masto' { + interface Status { + editedAt?: string + } +} + // @unocss-include export const STATUS_VISIBILITIES = [ { diff --git a/composables/time.ts b/composables/time.ts index 710b7928..b2dc268f 100644 --- a/composables/time.ts +++ b/composables/time.ts @@ -1,9 +1,12 @@ import type { MaybeRef } from '@vueuse/core' export const useFormattedDateTime = ( - value: MaybeRef, + value: MaybeRef, 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)) : '' + }) }