Table of Contents

**@arolariu/website**


@arolariu/website / sites/arolariu.ro/src/lib/utils.generic / formatCurrency

Function: formatCurrency()

formatCurrency(possibleAmount, options): string

Defined in: lib/utils.generic.ts:238

Formats a numeric amount as a localized currency string.

Parameters

possibleAmount

number

The numeric value to format.

options

FormatCurrencyOptions

Formatting configuration (currency code, locale, etc.).

Returns

string

Formatted currency string (e.g., "$1,234.56").

Remarks

Uses Intl.NumberFormat for consistent formatting.

Formatting Rules:

  • Default Locale: "en-US"
  • Default Style: Currency
  • Default Currency: "USD" (if not specified)

Example

formatCurrency(1234.56, { currency: "USD" }); // "$1,234.56"
formatCurrency(100, { currency: "EUR", locale: "de-DE" }); // "100,00 €"