- {{ published }}
+ {{ formattedPublished }}
{
- if (!props.date) return ''
- try {
- return new Date(props.date).toLocaleDateString('en-US', {
- year: 'numeric',
- month: 'short',
- day: 'numeric',
- })
- } catch {
- return props.date
- }
-})
+const formattedDate = computed(() => toLocaleDateString(props.date))
const MAX_VISIBLE_AUTHORS = 2
diff --git a/app/utils/formatters.ts b/app/utils/formatters.ts
index c135506d71..3190ac9e35 100644
--- a/app/utils/formatters.ts
+++ b/app/utils/formatters.ts
@@ -4,3 +4,17 @@ export function toIsoDateString(date: Date): string {
const day = String(date.getUTCDate()).padStart(2, '0')
return `${year}-${month}-${day}`
}
+
+export function toLocaleDateString(date: string): string {
+ if (!date) return ''
+
+ try {
+ return new Date(date).toLocaleDateString('en-US', {
+ year: 'numeric',
+ month: 'short',
+ day: 'numeric',
+ })
+ } catch {
+ return date
+ }
+}