-
Couldn't load subscription status.
- Fork 4
Function.formatCurrency
connor-baer edited this page Mar 28, 2025
·
75 revisions
@sumup-oss/intl / formatCurrency
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.