-
-
Notifications
You must be signed in to change notification settings - Fork 616
Description
Describe the bug
When using Intl.NumberFormat or the toLocaleString() method with the options bag { style: "percent" }, the Boa engine completely ignores the percent formatting rules. It fails to multiply the numeric value by 100 and does not append the locale-specific percent symbol to the output.
To Reproduce
This JavaScript code reproduces the issue for both BigInt and standard Number:
JavaScript
const options = { maximumSignificantDigits: 4, style: 'percent' };
console.log(88776655n.toLocaleString('de-DE', options));
console.log((88776655).toLocaleString('de-DE', options));
Expected behavior
Running this code, the values should be scaled by 100 and formatted with the localized percent symbol (e.g., "8.878.000.000 %"). Instead, the engine ignores the style: 'percent' option and outputs the standard decimal format "88.780.000".
The expected behavior can be found in the ECMAScript 402 specification for FormatNumeric.
Build environment (please complete the following information):
OS: Windows
Version: 11 / 10
Target triple: x86_64-pc-windows-msvc
Rustc version: rustc 1.94.0
Additional context
This missing implementation causes failures in the official Test262 conformance suite, specifically:
test262/test/intl402/BigInt/prototype/toLocaleString/de-DE.js
The root cause is an unimplemented feature in the ICU4X integration, currently marked with a // TODO: Missing support from ICU4X for Percent/Currency/Unit formatting. inside core/engine/src/builtins/intl/number_format/mod.rs.