Skip to content

Commit

Permalink
Normative: Allow use of non-ISO 4217 data in CurrencyDigits AO
Browse files Browse the repository at this point in the history
This PR allows for locale data other than ISO 4217 for determining
the number of fractional digits to be used when formatting currency
values.

In some applications ISO 4217 is most appropriate, in some CLDR data,
and in some neither is best. See tc39#921 (comment)

Resolves tc39#134

This PR makes the `CurrencyDigits` AO implementation-defined.
  • Loading branch information
ben-allen committed Aug 31, 2024
1 parent ef423a8 commit ce771ee
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
3 changes: 3 additions & 0 deletions spec/annexes.html
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,9 @@ <h1>Implementation Dependent Behaviour</h1>
<li>
The patterns used for formatting values as decimal, percent, currency, or unit values per locale, with or without the sign, with or without accounting format for currencies, and in standard, compact, or scientific notation (<emu-xref href="#sec-formatnumber"></emu-xref>)
</li>
<li>
The number of fractional digits used when formatting currency values (<emu-xref href="#sec-formatnumber"></emu-xref>)
</li>
<li>
Localized representations of *NaN* and *Infinity* (<emu-xref href="#sec-formatnumber"></emu-xref>)
</li>
Expand Down
11 changes: 4 additions & 7 deletions spec/numberformat.html
Original file line number Diff line number Diff line change
Expand Up @@ -684,19 +684,16 @@ <h1>Properties of Intl.NumberFormat Instances</h1>
<emu-clause id="sec-numberformat-abstracts">
<h1>Abstract Operations for NumberFormat Objects</h1>

<emu-clause id="sec-currencydigits" type="abstract operation">
<emu-clause id="sec-currencydigits" type="implementation-defined abstract operation">
<h1>
CurrencyDigits (
_currency_: a String,
_currency_: a well-formed ISO 4217 currency code,
): a non-negative integer
</h1>
<dl class="header">
<dt>description</dt>
<dd>The returned integer represents the number of fractional digits used when formatting quantities of the currency corresponding to _currency_.</dd>
</dl>
<emu-alg>
1. Assert: IsWellFormedCurrencyCode(_currency_) is *true*.
1. Assert: _currency_ is the ASCII-uppercase of _currency_.
1. If the ISO 4217 currency and funds code list contains _currency_ as an alphabetic code, return the minor unit value corresponding to the _currency_ from the list; otherwise, return 2.
</emu-alg>
</emu-clause>

<emu-clause id="sec-number-format-functions">
Expand Down

0 comments on commit ce771ee

Please sign in to comment.