Skip to content

API reference / @localizer/format-number / relativeUnitFormatter

Function: relativeUnitFormatter()

relativeUnitFormatter<T>(unit, options?): RelativeValueFormatter<T>

Defined in: relativeUnitFormatter.ts:34

Formats values relative to a reference using localized units.

Type Parameters

Type ParameterDescription
T extends number | bigintThe numeric type, either number or bigint.

Parameters

ParameterTypeDescription
unitUnitThe unit for formatting (e.g., 'meter', 'kilogram').
options?NumberFormatOptionsOptional formatting settings.

Returns

RelativeValueFormatter<T>

A function that formats a value relative to a reference.