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: redirect.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:567d4054-9bd1-f5e6-a3e7-974865270bcb |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 9A24:1E2E76:CE088E:1195058:6A4C5C23 |
| html-safe-nonce | 899413b4645e2a1f377b240ed7914362c775f4b6764ad88d44b1cb01584bdaa9 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5QTI0OjFFMkU3NjpDRTA4OEU6MTE5NTA1ODo2QTRDNUMyMyIsInZpc2l0b3JfaWQiOiIxNzQ3MTA0MDY1NzIxNzAyNzUiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 24cd4e9cd6c835a6128c2f78da63efd744254e6012c5080fc318eff0994c5b86 |
| 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 | 3d11bb817438277de2a940854450e83a7d32b6aeb5014e9e6b00a6423900251c |
| 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 | 14099438da5379150f15a2892474c7c7e6c0e55e |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width