Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support cash rounding #835

Open
sffc opened this issue Sep 18, 2023 · 3 comments
Open

Support cash rounding #835

sffc opened this issue Sep 18, 2023 · 3 comments
Assignees
Labels
c: numbers Component: numbers, currency, units s: discuss Status: TG2 must discuss to move forward
Milestone

Comments

@sffc
Copy link
Contributor

sffc commented Sep 18, 2023

See #134

CLDR has both normal (financial) rounding and cash rounding for currencies. We should consider adding an option to Intl.NumberFormat to support cash rounding.

@sffc sffc added s: discuss Status: TG2 must discuss to move forward c: numbers Component: numbers, currency, units labels Sep 18, 2023
@sffc sffc added this to the ES 2024 milestone Sep 18, 2023
@sffc
Copy link
Contributor Author

sffc commented Sep 18, 2023

Sample API:

new Intl.NumberFormat(undefined, { style: "currency", currencyRounding: "cash" })

Should the option be named:

  • currencyRounding
  • currencyPrecision
  • currencyUse

@ben-allen
Copy link
Contributor

I've put up PR #839 for this as an item for discussion. The PR uses currencyPrecision for the name of the option. currencyRounding seems bad (even though it's the most straightforward seeming) since it implies that only the rounding increment changes. currencyUse appears as valid as currencyPrecision, though.

@sffc
Copy link
Contributor Author

sffc commented Jan 22, 2024

TG2 discussion: https://github.com/tc39/ecma402/blob/master/meetings/notes-2024-01-18.md#support-cash-rounding-835

Conclusion: Add Test262 and docs for the current spec behavior.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c: numbers Component: numbers, currency, units s: discuss Status: TG2 must discuss to move forward
Projects
Status: Previously Discussed
2 participants