Skip to content

Commit

Permalink
Normative: When formatting currency values, only use data on the numb…
Browse files Browse the repository at this point in the history
…er of fractional units used to display that currency when using standard notation.

Previously this data was inappropriately used when using scientific, engineering, and compact notations. See issue tc39#912.
  • Loading branch information
ben-allen committed Sep 17, 2024
1 parent 60eda81 commit bcf7c38
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions spec/numberformat.html
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ <h1>Intl.NumberFormat ( [ _locales_ [ , _options_ ] ] )</h1>
1. Let _style_ be _numberFormat_.[[Style]].
1. If _style_ is *"currency"*, then
1. Let _currency_ be _numberFormat_.[[Currency]].
1. Let _notation_ be ? GetOption(_options_, *"notation"*, ~string~, « *"standard"*, *"scientific"*, *"engineering"*, *"compact"* », *"standard"*).
1. Set _numberFormat_.[[Notation]] to _notation_.
1. If _style_ is *"currency"* and *"notation"* is *"standard"*, then
1. Let _cDigits_ be CurrencyDigits(_currency_).
1. Let _mnfdDefault_ be _cDigits_.
1. Let _mxfdDefault_ be _cDigits_.
Expand All @@ -44,8 +47,6 @@ <h1>Intl.NumberFormat ( [ _locales_ [ , _options_ ] ] )</h1>
1. Let _mxfdDefault_ be 0.
1. Else,
1. Let _mxfdDefault_ be 3.
1. Let _notation_ be ? GetOption(_options_, *"notation"*, ~string~, « *"standard"*, *"scientific"*, *"engineering"*, *"compact"* », *"standard"*).
1. Set _numberFormat_.[[Notation]] to _notation_.
1. Perform ? SetNumberFormatDigitOptions(_numberFormat_, _options_, _mnfdDefault_, _mxfdDefault_, _notation_).
1. Let _compactDisplay_ be ? GetOption(_options_, *"compactDisplay"*, ~string~, « *"short"*, *"long"* », *"short"*).
1. Let _defaultUseGrouping_ be *"auto"*.
Expand Down

0 comments on commit bcf7c38

Please sign in to comment.