feat(04-01): add locale parameter to formatCurrency, default 'en'
- Replace hardcoded 'de-DE' with optional locale parameter defaulting to 'en' - Defensive locale || 'en' guard prevents RangeError on empty string - All existing call sites get English formatting (FIX-01) - Third arg enables locale-aware chart tooltips in follow-on plans
This commit is contained in:
@@ -1,5 +1,9 @@
|
||||
export function formatCurrency(amount: number, currency: string = 'EUR'): string {
|
||||
return new Intl.NumberFormat('de-DE', {
|
||||
export function formatCurrency(
|
||||
amount: number,
|
||||
currency: string = 'EUR',
|
||||
locale: string = 'en'
|
||||
): string {
|
||||
return new Intl.NumberFormat(locale || 'en', {
|
||||
style: 'currency',
|
||||
currency,
|
||||
}).format(amount)
|
||||
|
||||
Reference in New Issue
Block a user