Skip to content

getSymbols throws when using roundingIncrement >= 2 #7168

@macarie

Description

@macarie

Provide a general summary of the issue here

When a roundingIncrement >= 2 is used, getSymbols throws when creating symbolFormatter:

let symbolFormatter = new Intl.NumberFormat(locale, {...intlOptions, minimumSignificantDigits: 1, maximumSignificantDigits: 21});

🤔 Expected Behavior?

It should not allow the NumberFormat constructor to throw if the user's options are correct.

😯 Current Behavior

The constructor throws because the options are incompatible, as the function forcefully overrides minimumSignificantDigits and maximumSignificantDigits.

The error thrown (in Chrome) is:

Uncaught TypeError: RoundingType is not fractionDigits

Which seems to be a V8 internal error (?).

💁 Possible Solution

Setting roundingIncrement to undefined solves the issue, but I'm unsure if it has any side effects or causes any other issues. I've tried running the Jest test suite locally and the results are fine.

I've also tried spreading intlOptions at the end, so that minimumSignificantDigits and maximumSignificantDigits can get overridden, but the can still get all plural literals with minimum significant digits test fails when doing that.

🔦 Context

No response

🖥️ Steps to Reproduce

https://stackblitz.com/edit/vitejs-vite-ku6pdw?file=src%2FApp.tsx

Change roundingIncrement to 2, 5, or some other allowed value in src/App.tsx.

Version

main

What browsers are you seeing the problem on?

Chrome

If other, please specify.

No response

What operating system are you using?

macOS

🧢 Your Company/Team

No response

🕷 Tracking Issue

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions