ecma402 icon indicating copy to clipboard operation
ecma402 copied to clipboard

Support cash rounding

Open sffc opened this issue 1 year ago • 3 comments

See https://github.com/tc39/ecma402/issues/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 avatar Sep 18 '23 23:09 sffc

Sample API:

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

Should the option be named:

  • currencyRounding
  • currencyPrecision
  • currencyUse

sffc avatar Sep 18 '23 23:09 sffc

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.

ben-allen avatar Oct 18 '23 16:10 ben-allen

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.

sffc avatar Jan 22 '24 19:01 sffc