-
Notifications
You must be signed in to change notification settings - Fork 4
Variable.formatCurrency
connor-baer edited this page Jul 1, 2025
·
17 revisions
@sumup-oss/intl / formatCurrency
const
formatCurrency: (value
,locales?
,currency?
,options?
) =>string
Defined in: lib/number-format/index.ts:87
Formats a number in the country's official currency with support for various notations.
Parameter | Type |
---|---|
value |
number |
locales? |
string | string [] |
currency? |
string |
options? |
NumberFormatOptions |
string
import { formatCurrency } from '@sumup-oss/intl';
formatCurrency(12345.67, 'de-DE'); // '12.345,67 €'
formatCurrency(89, 'ja-JP', 'JPY'); // '¥89'
formatCurrency(16, 'en-GB', null, { currencyDisplay: 'name' }); // '16.00 British pounds'
In runtimes that don't support the Intl.NumberFormat
API, the currency is
formatted using the Number.toLocaleString
API.
The COP and HUF currencies are formatted without decimals.