Skip to content

Variable.resolveCurrencyFormat

kodiakhq[bot] edited this page Nov 1, 2025 · 34 revisions

@sumup-oss/intl / resolveCurrencyFormat

Variable: resolveCurrencyFormat()

const resolveCurrencyFormat: (locales?, currency?, options?) => NumberFormat | null

Defined in: lib/number-format/index.ts:364

Resolves the locale and collation options that are used to format a number in the country's official currency.

Parameters

Parameter Type
locales? string | string[]
currency? string
options? NumberFormatOptions

Returns

NumberFormat | null

Example

import { resolveCurrencyFormat } from '@sumup-oss/intl';

resolveCurrencyFormat();
// {
//   'locale': 'en-US',
//   'numberingSystem': 'latn',
//   'style': 'currency',
//   'currency': 'USD',
//   'currencyDisplay': 'symbol',
//   'minimumIntegerDigits': 1,
//   'minimumFractionDigits': 2,
//   'maximumFractionDigits': 2,
//   'useGrouping': true,
//   'groupDelimiter': '.',
//   'decimalDelimiter': ',',
//   'currencySymbol': '$',
//   'currencyPosition': 'prefix',
// }

resolveCurrencyFormat('ja-JP');
// {
//   'locale': 'ja-JP',
//   'numberingSystem': 'latn',
//   'style': 'currency',
//   'currency': 'JPY',
//   'currencyDisplay': 'symbol',
//   'minimumIntegerDigits': 1,
//   'minimumFractionDigits': 0,
//   'maximumFractionDigits': 0,
//   'useGrouping': true,
//   'groupDelimiter': ',',
//   'decimalDelimiter': undefined,
//   'currencySymbol': '¥',
//   'currencyPosition': 'prefix',
// }

resolveCurrencyFormat('en-GB', { currencyDisplay: 'name' });
// {
//   'locale': 'en-GB',
//   'numberingSystem': 'latn',
//   'style': 'currency',
//   'currency': 'GBP',
//   'currencyDisplay': 'symbol',
//   'minimumIntegerDigits': 1,
//   'minimumFractionDigits': 2,
//   'maximumFractionDigits': 2,
//   'useGrouping': true,
//   'groupDelimiter': ',',
//   'decimalDelimiter': '.',
//   'currencySymbol': 'British pounds',
//   'currencyPosition': 'suffix',
// }

Remarks

For convenience, groupDelimiter,decimalDelimiter, currencySymbol, and currencyPosition are returned in addition to the Intl.ResolvedNumberFormatOptions.

In runtimes that don't support the Intl.NumberFormat.resolvedOptions API, null is returned.

The COP and HUF currencies are formatted without decimals.

Clone this wiki locally