From a2cea49e9fd56567032deb589b655f275cedf52f Mon Sep 17 00:00:00 2001 From: Knee Cola Date: Sat, 22 Nov 2025 23:06:04 +0100 Subject: [PATCH] Update formatCurrency to handle optional currencyCode and default to EUR --- app/lib/formatStrings.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/lib/formatStrings.ts b/app/lib/formatStrings.ts index 7400062..edbb38e 100644 --- a/app/lib/formatStrings.ts +++ b/app/lib/formatStrings.ts @@ -1,4 +1,4 @@ -export const formatCurrency = (amount: number, currencyCode: string = "EUR") => { +export const formatCurrency = (amount: number, currencyCode?: string | null) => { // format number with 2 decimal places and a thousand separator // amount is in cents const amountInUnits = amount / 100; @@ -7,7 +7,7 @@ export const formatCurrency = (amount: number, currencyCode: string = "EUR") => try { return new Intl.NumberFormat('hr-HR', { style: 'currency', - currency: currencyCode, + currency: currencyCode ?? "EUR", minimumFractionDigits: 2, maximumFractionDigits: 2, }).format(amountInUnits);