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);