Title: Unexpected output of `Intl.NumberFormat#formatRange` with `percent` style for same values · Issue #46028 · nodejs/node · GitHub
Open Graph Title: Unexpected output of `Intl.NumberFormat#formatRange` with `percent` style for same values · Issue #46028 · nodejs/node
X Title: Unexpected output of `Intl.NumberFormat#formatRange` with `percent` style for same values · Issue #46028 · nodejs/node
Description: Version v19.3.0 Platform Microsoft Windows NT 10.0.22621.0 x64 Subsystem No response What steps will reproduce the bug? const percentFormatter = new Intl.NumberFormat("en-US", { style: "percent" }); console.log(percentFormatter.formatRan...
Open Graph Description: Version v19.3.0 Platform Microsoft Windows NT 10.0.22621.0 x64 Subsystem No response What steps will reproduce the bug? const percentFormatter = new Intl.NumberFormat("en-US", { style: "percent" })...
X Description: Version v19.3.0 Platform Microsoft Windows NT 10.0.22621.0 x64 Subsystem No response What steps will reproduce the bug? const percentFormatter = new Intl.NumberFormat("en-US", { style: &q...
Opengraph URL: https://github.com/nodejs/node/issues/46028
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Unexpected output of `Intl.NumberFormat#formatRange` with `percent` style for same values","articleBody":"### Version\n\nv19.3.0\n\n### Platform\n\nMicrosoft Windows NT 10.0.22621.0 x64\n\n### Subsystem\n\n_No response_\n\n### What steps will reproduce the bug?\n\n```js\r\nconst percentFormatter = new Intl.NumberFormat(\"en-US\", { style: \"percent\" });\r\n\r\nconsole.log(percentFormatter.formatRange(0.5, 0.55));\r\nconsole.log(percentFormatter.formatRange(0.5, 0.5));\r\n```\n\n### How often does it reproduce? Is there a required condition?\n\nall the time for all locales\n\n### What is the expected behavior?\n\n```\r\n50% – 55%\r\n~50%\r\n```\r\nSimilar to:\r\n```js\r\nconst numberFormatter = new Intl.NumberFormat(\"en-US\");\r\n\r\nconsole.log(numberFormatter.formatRange(50_000, 55_000)); // 50,000–55,000\r\nconsole.log(numberFormatter.formatRange(50_000, 50_000)); // ~50,000\r\n```\n\n### What do you see instead?\n\n```\r\n50% – 55%\r\n~5,000%\r\n```\n\n### Additional information\n\n`maximumFractionDigits` behavior:\r\n```js\r\n\u003e percentFormatter = new Intl.NumberFormat(\"en-US\", { style: 'percent' });\r\nNumberFormat [Intl.NumberFormat] {}\r\n\u003e percentFormatter.formatRange(0.1234, 0.1234)\r\n~1,200%\r\n\r\n\u003e percentFormatter = new Intl.NumberFormat(\"en-US\", { style: 'percent', maximumFractionDigits:10 });\r\nNumberFormat [Intl.NumberFormat] {}\r\n\u003e percentFormatter.formatRange(0.1234, 0.1234)\r\n~1,234%\r\n```","author":{"url":"https://github.com/mdashlw","@type":"Person","name":"mdashlw"},"datePublished":"2022-12-31T06:50:38.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":5},"url":"https://github.com/46028/node/issues/46028"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:20f44ddb-a81c-6d5c-8afd-d4d245ab9e04 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | A3CA:35ABFC:1DF6F92:2B0BC89:6A4CEB0B |
| html-safe-nonce | 1f712b5a0d0aca1683ce8109e4d30a84e0e2c6998eb8c620d96fb316b722d902 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBM0NBOjM1QUJGQzoxREY2RjkyOjJCMEJDODk6NkE0Q0VCMEIiLCJ2aXNpdG9yX2lkIjoiNjQ4MDMwMzk1Mjg1MTk1NDQ0MyIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 33d07f783c929f90a09e52eca5db1e6beb1045050b9636121aa871a61abdedd8 |
| hovercard-subject-tag | issue:1515036144 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/nodejs/node/46028/issue_layout |
| twitter:image | https://opengraph.githubassets.com/206f40c8d358ebef6bd609dced6563809f61a8136b9cc296cadd28a84f1689f1/nodejs/node/issues/46028 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/206f40c8d358ebef6bd609dced6563809f61a8136b9cc296cadd28a84f1689f1/nodejs/node/issues/46028 |
| og:image:alt | Version v19.3.0 Platform Microsoft Windows NT 10.0.22621.0 x64 Subsystem No response What steps will reproduce the bug? const percentFormatter = new Intl.NumberFormat("en-US", { style: "percent" })... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | mdashlw |
| hostname | github.com |
| expected-hostname | github.com |
| None | 299b43bca6e02ad35197ffeba30d2466846d5fb02ab96fbced5b5e6cec589fb8 |
| turbo-cache-control | no-preview |
| go-import | github.com/nodejs/node git https://github.com/nodejs/node.git |
| octolytics-dimension-user_id | 9950313 |
| octolytics-dimension-user_login | nodejs |
| octolytics-dimension-repository_id | 27193779 |
| octolytics-dimension-repository_nwo | nodejs/node |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 27193779 |
| octolytics-dimension-repository_network_root_nwo | nodejs/node |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | c5a57f04eeb310f57c73fd6d751d957e2ca27ed2 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width