-
Notifications
You must be signed in to change notification settings - Fork 101
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow compact notation to depend on style
#810
Labels
Projects
Comments
sffc
added
s: discuss
Status: TG2 must discuss to move forward
c: numbers
Component: numbers, currency, units
labels
Jul 25, 2023
not as confusing: const numFormat = new Intl.NumberFormat('en-US', { style: 'unit', unit: 'byte', notation: 'compact' });
let num = 1;
for (let i = 0; i < 15; i++) {
console.log(numFormat.format(num));
num *= 10;
}
more confusing: const numFormat = new Intl.NumberFormat('en-US', { style: 'unit', unit: 'byte', notation: 'compact', unitDisplay: 'narrow' });
let num = 1;
for (let i = 0; i < 15; i++) {
console.log(numFormat.format(num));
num *= 10;
}
|
If the unit is "byte", why would anyone describe it in terms of millions/billions/trillions instead of mega/giga/tera? |
see also: #730 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
Currently GetNotationSubPattern is a self-contained operation: https://tc39.es/ecma402/#sec-getnotationsubpattern
However, the notation subpattern can depend on the style. In ICU, this is already the case for currency, and it is likely useful for percent and unit styles as well.
Compact without currency:
https://unicode.org/cldr/charts/43/by_type/numbers.compact_decimal_formatting.html#76d709105676a7e5
Compact with currency:
https://unicode.org/cldr/charts/43/by_type/numbers.compact_decimal_formatting.html#122a473b23a455b1
By allowing this dependency, it could also give implementations more flexibility to use SI prefixes when style is "unit", instead of the default compact suffixes for that locale. CC @ljharb @ctcpip
The text was updated successfully, but these errors were encountered: