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 #921 (comment)

Resolves #134

This PR makes the `CurrencyDigits` AO implementation-defined.
  • Loading branch information
ben-allen committed Sep 12, 2024
1 parent ef423a8 commit c8aa18e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 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
7 changes: 5 additions & 2 deletions spec/numberformat.html
Original file line number Diff line number Diff line change
Expand Up @@ -684,18 +684,21 @@ <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,
): a non-negative integer
</h1>
<dl class="header">
<dt>description</dt>
<dd></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.
1. Return a non-negative integer indicating the number of fractional digits used when formatting quantities of the currency corresponding to _currency_. If there is no available information on the number of digits to be used, return 2.
</emu-alg>
</emu-clause>

Expand Down

0 comments on commit c8aa18e

Please sign in to comment.