When using a unitFormatter that takes a custom numberFormatter as an option, the formatter is called but the output is not used.
The number is dumped directly into the returned message instead of using the formatted value.
The following example illustrates an example.
var customNumberFormatter = Globalize('fr').numberFormatter({ maximumFractionDigits: 1 });
var metersPerLiter = formatUnit(1.234567, 'meter-per-liter', { form: 'narrow', numberFormatter: customNumberFormatter });
var milesPerHour = formatUnit(1.234567, 'mile-per-hour', { form: 'narrow', numberFormatter: customNumberFormatter });
assert(metersPerLiter).toBe('1,2m/l'); // Fails as metersPerLiter === '1.234567m/l' - note the period (.) instead of comma (,) too.
assert(milesPerHour).toBe('1,2mph'); // True
When using a unitFormatter that takes a custom numberFormatter as an option, the formatter is called but the output is not used. The number is dumped directly into the returned message instead of using the formatted value.
The following example illustrates an example.