Skip to content

Commit

Permalink
add locale to date formatter
Browse files Browse the repository at this point in the history
  • Loading branch information
ChristopherJohnston committed Aug 8, 2024
1 parent 31101fb commit 541e3dc
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/components/expense-activity-item.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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<Awaited<ReturnType<typeof getGroup>>>
Expand All @@ -23,6 +24,7 @@ export function ExpenseActivityItem({
}: Props) {
const router = useRouter()
const summary = useSummary(activity, participant?.name)
const locale = useLocale()

return (
<div
Expand All @@ -34,11 +36,11 @@ export function ExpenseActivityItem({
<div className="flex flex-col justify-between items-start">
{dateStyle !== undefined && (
<div className="mt-1 text-xs/5 text-muted-foreground">
{formatDate(activity.time, { dateStyle })}
{formatDate(activity.time, locale, { dateStyle })}
</div>
)}
<div className="my-1 text-xs/5 text-muted-foreground">
{formatDate(activity.time, { timeStyle: 'short' })}
{formatDate(activity.time, locale, { timeStyle: 'short' })}
</div>
</div>
<div className="flex-1">
Expand Down

0 comments on commit 541e3dc

Please sign in to comment.