镜像站点 · 本页由第三方 GitHub 只读镜像提供,非 GitHub 官方站点,不接受任何登录或凭据输入。前往 github.com
Skip to content

Unexpected output of Intl.NumberFormat#formatRange with percent style for same values #46028

Description

@mdashlw

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.formatRange(0.5, 0.55));
console.log(percentFormatter.formatRange(0.5, 0.5));

How often does it reproduce? Is there a required condition?

all the time for all locales

What is the expected behavior?

50% – 55%
~50%

Similar to:

const numberFormatter = new Intl.NumberFormat("en-US");

console.log(numberFormatter.formatRange(50_000, 55_000)); // 50,000–55,000
console.log(numberFormatter.formatRange(50_000, 50_000)); // ~50,000

What do you see instead?

50% – 55%
~5,000%

Additional information

maximumFractionDigits behavior:

> percentFormatter = new Intl.NumberFormat("en-US", { style: 'percent' });
NumberFormat [Intl.NumberFormat] {}
> percentFormatter.formatRange(0.1234, 0.1234)
~1,200%

> percentFormatter = new Intl.NumberFormat("en-US", { style: 'percent', maximumFractionDigits:10 });
NumberFormat [Intl.NumberFormat] {}
> percentFormatter.formatRange(0.1234, 0.1234)
~1,234%

Activity

  1. targos commented on Dec 31, 2022

    @targos
    Member

    I can confirm the results, but if it's a bug it will have to be fixed in the V8 engine or in ICU. Chromium has the same behavior.

    /cc @nodejs/i18n-api

  2. srl295 commented on Jan 1, 2023

    @srl295
    Member

    /cc @sffc

  3. added
    i18n-apiIssues and PRs related to Node.js internationalization support.
    on Jan 1, 2023
  4. sffc commented on Jan 10, 2023

    @sffc

    @FrankYFTang Any idea if this is a V8 bug? I haven't tested ICU yet, but there are plenty of ICU tests around this behavior so I would be surprised if it is in ICU.

  5. github-actions commented on Jun 22, 2026

    @github-actions
    Contributor

    This issue has been marked as stale due to 210 days of inactivity.
    It will be automatically closed in 30 days if no further activity occurs. If this is still relevant, please leave a comment or update it to keep it open.

  6. added
    staleIssues and PRs marked stale due to inactivity and scheduled for automatic closure.
    on Jun 22, 2026
  7. mdashlw commented on Jun 22, 2026

    @mdashlw
    Author

    This is no longer reproducible in Node LTS/Current (v24.17.0/v26.3.0) and latest Chrome (149.0.7827.156).

    Quick testing reveals this was fixed specifically in v20.20.1 which updated ICU to 78 (#60523).

    Related Bugzilla bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1917065
    Tracked down the upstream issue: ICU-22937 and ICU-23110 (fix: unicode-org/icu#3483).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    i18n-apiIssues and PRs related to Node.js internationalization support.staleIssues and PRs marked stale due to inactivity and scheduled for automatic closure.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions