From 541e3dc56de9f038dabd7a46b3c2dec7454d83ac Mon Sep 17 00:00:00 2001 From: Chris Johnston Date: Thu, 8 Aug 2024 18:40:20 +0100 Subject: [PATCH] add locale to date formatter --- src/components/expense-activity-item.tsx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/components/expense-activity-item.tsx b/src/components/expense-activity-item.tsx index c9b46ab6..abc57ffc 100644 --- a/src/components/expense-activity-item.tsx +++ b/src/components/expense-activity-item.tsx @@ -5,6 +5,7 @@ import { getExpense, getGroup } from '@/lib/api' import { DateTimeStyle, cn, formatDate } from '@/lib/utils' import { Activity, Participant } from '@prisma/client' import { useRouter } from 'next/navigation' +import { useLocale } from 'next-intl' type Props = { group: NonNullable>> @@ -23,6 +24,7 @@ export function ExpenseActivityItem({ }: Props) { const router = useRouter() const summary = useSummary(activity, participant?.name) + const locale = useLocale() return (
{dateStyle !== undefined && (
- {formatDate(activity.time, { dateStyle })} + {formatDate(activity.time, locale, { dateStyle })}
)}
- {formatDate(activity.time, { timeStyle: 'short' })} + {formatDate(activity.time, locale, { timeStyle: 'short' })}