Skip to content

Intl.NumberFormat: maximumFractionDigits is used for exact number of digits instead of maximum for style: "currency"Β #57137

Open
@amitbeck

Description

Version

v22.14.0

Platform

Darwin MacBook-Pro 24.3.0 Darwin Kernel Version 24.3.0: Thu Jan  2 20:24:23 PST 2025; root:xnu-11215.81.4~3/RELEASE_ARM64_T6020 arm64

Subsystem

No response

What steps will reproduce the bug?

Run the following:

Intl.NumberFormat('en-US', {
  notation: 'compact',
  maximumFractionDigits: 1,
  style: 'currency',
  currency: 'USD'
}).format(3_000_000)

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

Constantly

What is the expected behavior? Why is that the expected behavior?

The previous code snippet should output "$3M", because the number is round, notation is set to "compact" and maximumFractionDigits is set to 1. For comparison Chrome 133.0.6943.98 (V8 13.3.415.21) correctly outputs "$3M".

What do you see instead?

The previous code outputs "$3.0M" in Node.js v22.14.0 (V8 12.4.254.21-node.22), while Chrome 133.0.6943.98 (V8 13.3.415.21) outputs "$3M".

It seems that when using style: "currency" and specifying maximumFractionDigits, for some reason Node.js uses that number as the exact number of fraction digits instead of a maximum.

Additional information

No response

Activity

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

Metadata

Assignees

No one assigned

    Labels

    i18n-apiIssues and PRs related to the i18n implementation.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions