-
Notifications
You must be signed in to change notification settings - Fork 4
Variable.formatNumber
connor-baer edited this page Oct 23, 2025
·
32 revisions
@sumup-oss/intl / formatNumber
constformatNumber: (value,locales?,options?) =>string
Defined in: lib/number-format/index.ts:62
Formats a number with support for various styles, units, and notations.
| Parameter | Type |
|---|---|
value |
number |
locales? |
string | string[] |
options? |
NumberFormatOptions |
string
import { formatNumber } from '@sumup-oss/intl';
formatNumber(12345.67, 'de-DE'); // '12.345,67'
formatNumber(-0.89, ['ban', 'id']); // '-0,89'
formatNumber(16, 'en-GB', {
style: 'unit',
unit: 'liter',
unitDisplay: 'long',
}); // 16 litresIn runtimes that don't support the Intl.NumberFormat API, the number is
formatted using the Number.toLocaleString API.