diff --git a/spec/datetimeformat.html b/spec/datetimeformat.html index ead7c708..56e96470 100644 --- a/spec/datetimeformat.html +++ b/spec/datetimeformat.html @@ -23,168 +23,6 @@

Intl.DateTimeFormat ( [ _locales_ [ , _options_ ] ] )

1. Return ? ChainDateTimeFormat(_dateTimeFormat_, NewTarget, _this_). 1. Return _dateTimeFormat_. - - - -

- ChainDateTimeFormat ( - _dateTimeFormat_: an Intl.DateTimeFormat, - _newTarget_: an ECMAScript language value, - _this_: an ECMAScript language value, - ): either a normal completion containing an Object or a throw completion -

-
-
- - 1. If _newTarget_ is *undefined* and ? OrdinaryHasInstance(%Intl.DateTimeFormat%, _this_) is *true*, then - 1. Perform ? DefinePropertyOrThrow(_this_, %Intl%.[[FallbackSymbol]], PropertyDescriptor{ [[Value]]: _dateTimeFormat_, [[Writable]]: *false*, [[Enumerable]]: *false*, [[Configurable]]: *false* }). - 1. Return _this_. - 1. Return _dateTimeFormat_. - -
-
- - - -

- CreateDateTimeFormat ( - _newTarget_: a constructor, - _locales_: an ECMAScript language value, - _options_: an ECMAScript language value, - _required_: ~date~, ~time~, or ~any~, - _defaults_: ~date~, ~time~, or ~all~, - ): either a normal completion containing a DateTimeFormat object or a throw completion -

- -
-
- - - 1. Let _dateTimeFormat_ be ? OrdinaryCreateFromConstructor(_newTarget_, *"%Intl.DateTimeFormat.prototype%"*, « [[InitializedDateTimeFormat]], [[Locale]], [[Calendar]], [[NumberingSystem]], [[TimeZone]], [[HourCycle]], [[DateStyle]], [[TimeStyle]], [[DateTimeFormat]], [[BoundFormat]] »). - 1. Let _requestedLocales_ be ? CanonicalizeLocaleList(_locales_). - 1. Set _options_ to ? CoerceOptionsToObject(_options_). - 1. Let _opt_ be a new Record. - 1. Let _matcher_ be ? GetOption(_options_, *"localeMatcher"*, ~string~, « *"lookup"*, *"best fit"* », *"best fit"*). - 1. Set _opt_.[[localeMatcher]] to _matcher_. - 1. Let _calendar_ be ? GetOption(_options_, *"calendar"*, ~string~, ~empty~, *undefined*). - 1. If _calendar_ is not *undefined*, then - 1. If _calendar_ cannot be matched by the type Unicode locale nonterminal, throw a *RangeError* exception. - 1. Set _opt_.[[ca]] to _calendar_. - 1. Let _numberingSystem_ be ? GetOption(_options_, *"numberingSystem"*, ~string~, ~empty~, *undefined*). - 1. If _numberingSystem_ is not *undefined*, then - 1. If _numberingSystem_ cannot be matched by the type Unicode locale nonterminal, throw a *RangeError* exception. - 1. Set _opt_.[[nu]] to _numberingSystem_. - 1. Let _hour12_ be ? GetOption(_options_, *"hour12"*, ~boolean~, ~empty~, *undefined*). - 1. Let _hourCycle_ be ? GetOption(_options_, *"hourCycle"*, ~string~, « *"h11"*, *"h12"*, *"h23"*, *"h24"* », *undefined*). - 1. If _hour12_ is not *undefined*, then - 1. Set _hourCycle_ to *null*. - 1. Set _opt_.[[hc]] to _hourCycle_. - 1. Let _r_ be ResolveLocale(%Intl.DateTimeFormat%.[[AvailableLocales]], _requestedLocales_, _opt_, %Intl.DateTimeFormat%.[[RelevantExtensionKeys]], %Intl.DateTimeFormat%.[[LocaleData]]). - 1. Set _dateTimeFormat_.[[Locale]] to _r_.[[Locale]]. - 1. Let _resolvedCalendar_ be _r_.[[ca]]. - 1. Set _dateTimeFormat_.[[Calendar]] to _resolvedCalendar_. - 1. Set _dateTimeFormat_.[[NumberingSystem]] to _r_.[[nu]]. - 1. Let _resolvedLocaleData_ be _r_.[[LocaleData]]. - 1. If _hour12_ is *true*, then - 1. Let _hc_ be _resolvedLocaleData_.[[hourCycle12]]. - 1. Else if _hour12_ is *false*, then - 1. Let _hc_ be _resolvedLocaleData_.[[hourCycle24]]. - 1. Else, - 1. Assert: _hour12_ is *undefined*. - 1. Let _hc_ be _r_.[[hc]]. - 1. If _hc_ is *null*, set _hc_ to _resolvedLocaleData_.[[hourCycle]]. - 1. Let _timeZone_ be ? Get(_options_, *"timeZone"*). - 1. If _timeZone_ is *undefined*, then - 1. Set _timeZone_ to SystemTimeZoneIdentifier(). - 1. Else, - 1. Set _timeZone_ to ? ToString(_timeZone_). - 1. If IsTimeZoneOffsetString(_timeZone_) is *true*, then - 1. Let _parseResult_ be ParseText(StringToCodePoints(_timeZone_), |UTCOffset|). - 1. Assert: _parseResult_ is a Parse Node. - 1. If _parseResult_ contains more than one |MinuteSecond| Parse Node, throw a *RangeError* exception. - 1. Let _offsetNanoseconds_ be ParseTimeZoneOffsetString(_timeZone_). - 1. Let _offsetMinutes_ be _offsetNanoseconds_ / (6 × 1010). - 1. Assert: _offsetMinutes_ is an integer. - 1. Set _timeZone_ to FormatOffsetTimeZoneIdentifier(_offsetMinutes_). - 1. Else, - 1. Let _timeZoneIdentifierRecord_ be GetAvailableNamedTimeZoneIdentifier(_timeZone_). - 1. If _timeZoneIdentifierRecord_ is ~empty~, throw a *RangeError* exception. - 1. Set _timeZone_ to _timeZoneIdentifierRecord_.[[PrimaryIdentifier]]. - 1. Set _dateTimeFormat_.[[TimeZone]] to _timeZone_. - 1. Let _formatOptions_ be a new Record. - 1. Set _formatOptions_.[[hourCycle]] to _hc_. - 1. Let _hasExplicitFormatComponents_ be *false*. - 1. For each row of , except the header row, in table order, do - 1. Let _prop_ be the name given in the Property column of the current row. - 1. If _prop_ is *"fractionalSecondDigits"*, then - 1. Let _value_ be ? GetNumberOption(_options_, *"fractionalSecondDigits"*, 1, 3, *undefined*). - 1. Else, - 1. Let _values_ be a List whose elements are the strings given in the Values column of the current row. - 1. Let _value_ be ? GetOption(_options_, _prop_, ~string~, _values_, *undefined*). - 1. Set _formatOptions_.[[<_prop_>]] to _value_. - 1. If _value_ is not *undefined*, then - 1. Set _hasExplicitFormatComponents_ to *true*. - 1. Let _formatMatcher_ be ? GetOption(_options_, *"formatMatcher"*, ~string~, « *"basic"*, *"best fit"* », *"best fit"*). - 1. Let _dateStyle_ be ? GetOption(_options_, *"dateStyle"*, ~string~, « *"full"*, *"long"*, *"medium"*, *"short"* », *undefined*). - 1. Set _dateTimeFormat_.[[DateStyle]] to _dateStyle_. - 1. Let _timeStyle_ be ? GetOption(_options_, *"timeStyle"*, ~string~, « *"full"*, *"long"*, *"medium"*, *"short"* », *undefined*). - 1. Set _dateTimeFormat_.[[TimeStyle]] to _timeStyle_. - 1. If _dateStyle_ is not *undefined* or _timeStyle_ is not *undefined*, then - 1. If _hasExplicitFormatComponents_ is *true*, then - 1. Throw a *TypeError* exception. - 1. If _required_ is ~date~ and _timeStyle_ is not *undefined*, then - 1. Throw a *TypeError* exception. - 1. If _required_ is ~time~ and _dateStyle_ is not *undefined*, then - 1. Throw a *TypeError* exception. - 1. Let _styles_ be _resolvedLocaleData_.[[styles]].[[<_resolvedCalendar_>]]. - 1. Let _bestFormat_ be DateTimeStyleFormat(_dateStyle_, _timeStyle_, _styles_). - 1. Else, - 1. Let _needDefaults_ be *true*. - 1. If _required_ is ~date~ or ~any~, then - 1. For each property name _prop_ of « *"weekday"*, *"year"*, *"month"*, *"day"* », do - 1. Let _value_ be _formatOptions_.[[<_prop_>]]. - 1. If _value_ is not *undefined*, set _needDefaults_ to *false*. - 1. If _required_ is ~time~ or ~any~, then - 1. For each property name _prop_ of « *"dayPeriod"*, *"hour"*, *"minute"*, *"second"*, *"fractionalSecondDigits"* », do - 1. Let _value_ be _formatOptions_.[[<_prop_>]]. - 1. If _value_ is not *undefined*, set _needDefaults_ to *false*. - 1. If _needDefaults_ is *true* and _defaults_ is either ~date~ or ~all~, then - 1. For each property name _prop_ of « *"year"*, *"month"*, *"day"* », do - 1. Set _formatOptions_.[[<_prop_>]] to *"numeric"*. - 1. If _needDefaults_ is *true* and _defaults_ is either ~time~ or ~all~, then - 1. For each property name _prop_ of « *"hour"*, *"minute"*, *"second"* », do - 1. Set _formatOptions_.[[<_prop_>]] to *"numeric"*. - 1. Let _formats_ be _resolvedLocaleData_.[[formats]].[[<_resolvedCalendar_>]]. - 1. If _formatMatcher_ is *"basic"*, then - 1. Let _bestFormat_ be BasicFormatMatcher(_formatOptions_, _formats_). - 1. Else, - 1. Let _bestFormat_ be BestFitFormatMatcher(_formatOptions_, _formats_). - 1. Set _dateTimeFormat_.[[DateTimeFormat]] to _bestFormat_. - 1. If _bestFormat_ has a field [[hour]], then - 1. Set _dateTimeFormat_.[[HourCycle]] to _hc_. - 1. Return _dateTimeFormat_. - -
- - -

- FormatOffsetTimeZoneIdentifier ( - _offsetMinutes_: an integer, - ): a String -

-
-
description
-
- It formats a UTC offset, in minutes, into a UTC offset string formatted like ±HH:MM. -
-
- - 1. If _offsetMinutes_ ≥ 0, let _sign_ be the code unit 0x002B (PLUS SIGN); otherwise, let _sign_ be the code unit 0x002D (HYPHEN-MINUS). - 1. Let _absoluteMinutes_ be abs(_offsetMinutes_). - 1. Let _hours_ be floor(_absoluteMinutes_ / 60). - 1. Let _minutes_ be _absoluteMinutes_ modulo 60. - 1. Return the string-concatenation of _sign_, ToZeroPaddedDecimalString(_hours_, 2), the code unit 0x003A (COLON), and ToZeroPaddedDecimalString(_minutes_, 2). -
@@ -1245,6 +1083,168 @@

Abstract Operations for DateTimeFormat Objects

+ + +

+ ChainDateTimeFormat ( + _dateTimeFormat_: an Intl.DateTimeFormat, + _newTarget_: an ECMAScript language value, + _this_: an ECMAScript language value, + ): either a normal completion containing an Object or a throw completion +

+
+
+ + 1. If _newTarget_ is *undefined* and ? OrdinaryHasInstance(%Intl.DateTimeFormat%, _this_) is *true*, then + 1. Perform ? DefinePropertyOrThrow(_this_, %Intl%.[[FallbackSymbol]], PropertyDescriptor{ [[Value]]: _dateTimeFormat_, [[Writable]]: *false*, [[Enumerable]]: *false*, [[Configurable]]: *false* }). + 1. Return _this_. + 1. Return _dateTimeFormat_. + +
+
+ + +

+ CreateDateTimeFormat ( + _newTarget_: a constructor, + _locales_: an ECMAScript language value, + _options_: an ECMAScript language value, + _required_: ~date~, ~time~, or ~any~, + _defaults_: ~date~, ~time~, or ~all~, + ): either a normal completion containing a DateTimeFormat object or a throw completion +

+ +
+
+ + + 1. Let _dateTimeFormat_ be ? OrdinaryCreateFromConstructor(_newTarget_, *"%Intl.DateTimeFormat.prototype%"*, « [[InitializedDateTimeFormat]], [[Locale]], [[Calendar]], [[NumberingSystem]], [[TimeZone]], [[HourCycle]], [[DateStyle]], [[TimeStyle]], [[DateTimeFormat]], [[BoundFormat]] »). + 1. Let _requestedLocales_ be ? CanonicalizeLocaleList(_locales_). + 1. Set _options_ to ? CoerceOptionsToObject(_options_). + 1. Let _opt_ be a new Record. + 1. Let _matcher_ be ? GetOption(_options_, *"localeMatcher"*, ~string~, « *"lookup"*, *"best fit"* », *"best fit"*). + 1. Set _opt_.[[localeMatcher]] to _matcher_. + 1. Let _calendar_ be ? GetOption(_options_, *"calendar"*, ~string~, ~empty~, *undefined*). + 1. If _calendar_ is not *undefined*, then + 1. If _calendar_ cannot be matched by the type Unicode locale nonterminal, throw a *RangeError* exception. + 1. Set _opt_.[[ca]] to _calendar_. + 1. Let _numberingSystem_ be ? GetOption(_options_, *"numberingSystem"*, ~string~, ~empty~, *undefined*). + 1. If _numberingSystem_ is not *undefined*, then + 1. If _numberingSystem_ cannot be matched by the type Unicode locale nonterminal, throw a *RangeError* exception. + 1. Set _opt_.[[nu]] to _numberingSystem_. + 1. Let _hour12_ be ? GetOption(_options_, *"hour12"*, ~boolean~, ~empty~, *undefined*). + 1. Let _hourCycle_ be ? GetOption(_options_, *"hourCycle"*, ~string~, « *"h11"*, *"h12"*, *"h23"*, *"h24"* », *undefined*). + 1. If _hour12_ is not *undefined*, then + 1. Set _hourCycle_ to *null*. + 1. Set _opt_.[[hc]] to _hourCycle_. + 1. Let _r_ be ResolveLocale(%Intl.DateTimeFormat%.[[AvailableLocales]], _requestedLocales_, _opt_, %Intl.DateTimeFormat%.[[RelevantExtensionKeys]], %Intl.DateTimeFormat%.[[LocaleData]]). + 1. Set _dateTimeFormat_.[[Locale]] to _r_.[[Locale]]. + 1. Let _resolvedCalendar_ be _r_.[[ca]]. + 1. Set _dateTimeFormat_.[[Calendar]] to _resolvedCalendar_. + 1. Set _dateTimeFormat_.[[NumberingSystem]] to _r_.[[nu]]. + 1. Let _resolvedLocaleData_ be _r_.[[LocaleData]]. + 1. If _hour12_ is *true*, then + 1. Let _hc_ be _resolvedLocaleData_.[[hourCycle12]]. + 1. Else if _hour12_ is *false*, then + 1. Let _hc_ be _resolvedLocaleData_.[[hourCycle24]]. + 1. Else, + 1. Assert: _hour12_ is *undefined*. + 1. Let _hc_ be _r_.[[hc]]. + 1. If _hc_ is *null*, set _hc_ to _resolvedLocaleData_.[[hourCycle]]. + 1. Let _timeZone_ be ? Get(_options_, *"timeZone"*). + 1. If _timeZone_ is *undefined*, then + 1. Set _timeZone_ to SystemTimeZoneIdentifier(). + 1. Else, + 1. Set _timeZone_ to ? ToString(_timeZone_). + 1. If IsTimeZoneOffsetString(_timeZone_) is *true*, then + 1. Let _parseResult_ be ParseText(StringToCodePoints(_timeZone_), |UTCOffset|). + 1. Assert: _parseResult_ is a Parse Node. + 1. If _parseResult_ contains more than one |MinuteSecond| Parse Node, throw a *RangeError* exception. + 1. Let _offsetNanoseconds_ be ParseTimeZoneOffsetString(_timeZone_). + 1. Let _offsetMinutes_ be _offsetNanoseconds_ / (6 × 1010). + 1. Assert: _offsetMinutes_ is an integer. + 1. Set _timeZone_ to FormatOffsetTimeZoneIdentifier(_offsetMinutes_). + 1. Else, + 1. Let _timeZoneIdentifierRecord_ be GetAvailableNamedTimeZoneIdentifier(_timeZone_). + 1. If _timeZoneIdentifierRecord_ is ~empty~, throw a *RangeError* exception. + 1. Set _timeZone_ to _timeZoneIdentifierRecord_.[[PrimaryIdentifier]]. + 1. Set _dateTimeFormat_.[[TimeZone]] to _timeZone_. + 1. Let _formatOptions_ be a new Record. + 1. Set _formatOptions_.[[hourCycle]] to _hc_. + 1. Let _hasExplicitFormatComponents_ be *false*. + 1. For each row of , except the header row, in table order, do + 1. Let _prop_ be the name given in the Property column of the current row. + 1. If _prop_ is *"fractionalSecondDigits"*, then + 1. Let _value_ be ? GetNumberOption(_options_, *"fractionalSecondDigits"*, 1, 3, *undefined*). + 1. Else, + 1. Let _values_ be a List whose elements are the strings given in the Values column of the current row. + 1. Let _value_ be ? GetOption(_options_, _prop_, ~string~, _values_, *undefined*). + 1. Set _formatOptions_.[[<_prop_>]] to _value_. + 1. If _value_ is not *undefined*, then + 1. Set _hasExplicitFormatComponents_ to *true*. + 1. Let _formatMatcher_ be ? GetOption(_options_, *"formatMatcher"*, ~string~, « *"basic"*, *"best fit"* », *"best fit"*). + 1. Let _dateStyle_ be ? GetOption(_options_, *"dateStyle"*, ~string~, « *"full"*, *"long"*, *"medium"*, *"short"* », *undefined*). + 1. Set _dateTimeFormat_.[[DateStyle]] to _dateStyle_. + 1. Let _timeStyle_ be ? GetOption(_options_, *"timeStyle"*, ~string~, « *"full"*, *"long"*, *"medium"*, *"short"* », *undefined*). + 1. Set _dateTimeFormat_.[[TimeStyle]] to _timeStyle_. + 1. If _dateStyle_ is not *undefined* or _timeStyle_ is not *undefined*, then + 1. If _hasExplicitFormatComponents_ is *true*, then + 1. Throw a *TypeError* exception. + 1. If _required_ is ~date~ and _timeStyle_ is not *undefined*, then + 1. Throw a *TypeError* exception. + 1. If _required_ is ~time~ and _dateStyle_ is not *undefined*, then + 1. Throw a *TypeError* exception. + 1. Let _styles_ be _resolvedLocaleData_.[[styles]].[[<_resolvedCalendar_>]]. + 1. Let _bestFormat_ be DateTimeStyleFormat(_dateStyle_, _timeStyle_, _styles_). + 1. Else, + 1. Let _needDefaults_ be *true*. + 1. If _required_ is ~date~ or ~any~, then + 1. For each property name _prop_ of « *"weekday"*, *"year"*, *"month"*, *"day"* », do + 1. Let _value_ be _formatOptions_.[[<_prop_>]]. + 1. If _value_ is not *undefined*, set _needDefaults_ to *false*. + 1. If _required_ is ~time~ or ~any~, then + 1. For each property name _prop_ of « *"dayPeriod"*, *"hour"*, *"minute"*, *"second"*, *"fractionalSecondDigits"* », do + 1. Let _value_ be _formatOptions_.[[<_prop_>]]. + 1. If _value_ is not *undefined*, set _needDefaults_ to *false*. + 1. If _needDefaults_ is *true* and _defaults_ is either ~date~ or ~all~, then + 1. For each property name _prop_ of « *"year"*, *"month"*, *"day"* », do + 1. Set _formatOptions_.[[<_prop_>]] to *"numeric"*. + 1. If _needDefaults_ is *true* and _defaults_ is either ~time~ or ~all~, then + 1. For each property name _prop_ of « *"hour"*, *"minute"*, *"second"* », do + 1. Set _formatOptions_.[[<_prop_>]] to *"numeric"*. + 1. Let _formats_ be _resolvedLocaleData_.[[formats]].[[<_resolvedCalendar_>]]. + 1. If _formatMatcher_ is *"basic"*, then + 1. Let _bestFormat_ be BasicFormatMatcher(_formatOptions_, _formats_). + 1. Else, + 1. Let _bestFormat_ be BestFitFormatMatcher(_formatOptions_, _formats_). + 1. Set _dateTimeFormat_.[[DateTimeFormat]] to _bestFormat_. + 1. If _bestFormat_ has a field [[hour]], then + 1. Set _dateTimeFormat_.[[HourCycle]] to _hc_. + 1. Return _dateTimeFormat_. + +
+ + +

+ FormatOffsetTimeZoneIdentifier ( + _offsetMinutes_: an integer, + ): a String +

+
+
description
+
+ It formats a UTC offset, in minutes, into a UTC offset string formatted like ±HH:MM. +
+
+ + 1. If _offsetMinutes_ ≥ 0, let _sign_ be the code unit 0x002B (PLUS SIGN); otherwise, let _sign_ be the code unit 0x002D (HYPHEN-MINUS). + 1. Let _absoluteMinutes_ be abs(_offsetMinutes_). + 1. Let _hours_ be floor(_absoluteMinutes_ / 60). + 1. Let _minutes_ be _absoluteMinutes_ modulo 60. + 1. Return the string-concatenation of _sign_, ToZeroPaddedDecimalString(_hours_, 2), the code unit 0x003A (COLON), and ToZeroPaddedDecimalString(_minutes_, 2). + +
+

DateTimeStyleFormat ( diff --git a/spec/locale.html b/spec/locale.html index 3420a2e2..fbdc9687 100644 --- a/spec/locale.html +++ b/spec/locale.html @@ -69,84 +69,6 @@

Intl.Locale ( _tag_ [ , _options_ ] )

1. Return _locale_.
- - -

- UpdateLanguageId ( - _tag_: a Unicode canonicalized locale identifier, - _options_: an Object, - ): either a normal completion containing a language tag or a throw completion -

-
-
description
-
It updates the unicode_language_id subtags in _tag_ from the corresponding properties of _options_ and returns the structurally valid but non-canonicalized result.
-
- - 1. Let _languageId_ be the longest prefix of _tag_ matched by the unicode_language_id Unicode locale nonterminal. - 1. Let _language_ be ? GetOption(_options_, *"language"*, ~string~, ~empty~, GetLocaleLanguage(_languageId_)). - 1. If _language_ cannot be matched by the unicode_language_subtag Unicode locale nonterminal, throw a *RangeError* exception. - 1. Let _script_ be ? GetOption(_options_, *"script"*, ~string~, ~empty~, GetLocaleScript(_languageId_)). - 1. If _script_ is not *undefined*, then - 1. If _script_ cannot be matched by the unicode_script_subtag Unicode locale nonterminal, throw a *RangeError* exception. - 1. Let _region_ be ? GetOption(_options_, *"region"*, ~string~, ~empty~, GetLocaleRegion(_languageId_)). - 1. If _region_ is not *undefined*, then - 1. If _region_ cannot be matched by the unicode_region_subtag Unicode locale nonterminal, throw a *RangeError* exception. - 1. Let _variants_ be GetLocaleVariants(_languageId_). - 1. Let _newLanguageId_ be _language_. - 1. If _script_ is not *undefined*, set _newLanguageId_ to the string-concatenation of _newLanguageId_, *"-"*, and _script_. - 1. If _region_ is not *undefined*, set _newLanguageId_ to the string-concatenation of _newLanguageId_, *"-"*, and _region_. - 1. If _variants_ is not *undefined*, set _newLanguageId_ to the string-concatenation of _newLanguageId_, *"-"*, and _variants_. - 1. Let _newTag_ be _tag_ with the substring matched by the unicode_language_id Unicode locale nonterminal replaced by the string _newLanguageId_. - 1. Return _newTag_. - -
- - -

- MakeLocaleRecord ( - _tag_: a language tag, - _options_: a Record, - _localeExtensionKeys_: a List of Strings, - ): a Record -

-
-
description
-
It constructs and returns a Record in which each element of _localeExtensionKeys_ defines a corresponding field with data from any Unicode locale extension sequence of _tag_ as overridden by a corresponding field of _options_, and which additionally includes a [[locale]] field containing a Unicode canonicalized locale identifier resulting from incorporating those fields into _tag_.
-
- - 1. If _tag_ contains a substring that is a Unicode locale extension sequence, then - 1. Let _extension_ be the String value consisting of the substring of the Unicode locale extension sequence within _tag_. - 1. Let _components_ be UnicodeExtensionComponents(_extension_). - 1. Let _attributes_ be _components_.[[Attributes]]. - 1. Let _keywords_ be _components_.[[Keywords]]. - 1. Else, - 1. Let _attributes_ be a new empty List. - 1. Let _keywords_ be a new empty List. - 1. Let _result_ be a new Record. - 1. For each element _key_ of _localeExtensionKeys_, do - 1. If _keywords_ contains an element whose [[Key]] is _key_, then - 1. Let _entry_ be the element of _keywords_ whose [[Key]] is _key_. - 1. Let _value_ be _entry_.[[Value]]. - 1. Else, - 1. Let _entry_ be ~empty~. - 1. Let _value_ be *undefined*. - 1. Assert: _options_ has a field [[<_key_>]]. - 1. Let _overrideValue_ be _options_.[[<_key_>]]. - 1. If _overrideValue_ is not *undefined*, then - 1. Set _value_ to CanonicalizeUValue(_key_, _overrideValue_). - 1. If _entry_ is not ~empty~, then - 1. Set _entry_.[[Value]] to _value_. - 1. Else, - 1. Append the Record { [[Key]]: _key_, [[Value]]: _value_ } to _keywords_. - 1. Set _result_.[[<_key_>]] to _value_. - 1. Let _locale_ be the String value that is _tag_ with any Unicode locale extension sequences removed. - 1. If _attributes_ is not empty or _keywords_ is not empty, then - 1. Set _result_.[[locale]] to InsertUnicodeExtensionAndCanonicalize(_locale_, _attributes_, _keywords_). - 1. Else, - 1. Set _result_.[[locale]] to CanonicalizeUnicodeLocaleId(_locale_). - 1. Return _result_. - -
@@ -368,6 +290,84 @@

Properties of Intl.Locale Instances

Abstract Operations for Locale Objects

+ +

+ UpdateLanguageId ( + _tag_: a Unicode canonicalized locale identifier, + _options_: an Object, + ): either a normal completion containing a language tag or a throw completion +

+
+
description
+
It updates the unicode_language_id subtags in _tag_ from the corresponding properties of _options_ and returns the structurally valid but non-canonicalized result.
+
+ + 1. Let _languageId_ be the longest prefix of _tag_ matched by the unicode_language_id Unicode locale nonterminal. + 1. Let _language_ be ? GetOption(_options_, *"language"*, ~string~, ~empty~, GetLocaleLanguage(_languageId_)). + 1. If _language_ cannot be matched by the unicode_language_subtag Unicode locale nonterminal, throw a *RangeError* exception. + 1. Let _script_ be ? GetOption(_options_, *"script"*, ~string~, ~empty~, GetLocaleScript(_languageId_)). + 1. If _script_ is not *undefined*, then + 1. If _script_ cannot be matched by the unicode_script_subtag Unicode locale nonterminal, throw a *RangeError* exception. + 1. Let _region_ be ? GetOption(_options_, *"region"*, ~string~, ~empty~, GetLocaleRegion(_languageId_)). + 1. If _region_ is not *undefined*, then + 1. If _region_ cannot be matched by the unicode_region_subtag Unicode locale nonterminal, throw a *RangeError* exception. + 1. Let _variants_ be GetLocaleVariants(_languageId_). + 1. Let _newLanguageId_ be _language_. + 1. If _script_ is not *undefined*, set _newLanguageId_ to the string-concatenation of _newLanguageId_, *"-"*, and _script_. + 1. If _region_ is not *undefined*, set _newLanguageId_ to the string-concatenation of _newLanguageId_, *"-"*, and _region_. + 1. If _variants_ is not *undefined*, set _newLanguageId_ to the string-concatenation of _newLanguageId_, *"-"*, and _variants_. + 1. Let _newTag_ be _tag_ with the substring matched by the unicode_language_id Unicode locale nonterminal replaced by the string _newLanguageId_. + 1. Return _newTag_. + +
+ + +

+ MakeLocaleRecord ( + _tag_: a language tag, + _options_: a Record, + _localeExtensionKeys_: a List of Strings, + ): a Record +

+
+
description
+
It constructs and returns a Record in which each element of _localeExtensionKeys_ defines a corresponding field with data from any Unicode locale extension sequence of _tag_ as overridden by a corresponding field of _options_, and which additionally includes a [[locale]] field containing a Unicode canonicalized locale identifier resulting from incorporating those fields into _tag_.
+
+ + 1. If _tag_ contains a substring that is a Unicode locale extension sequence, then + 1. Let _extension_ be the String value consisting of the substring of the Unicode locale extension sequence within _tag_. + 1. Let _components_ be UnicodeExtensionComponents(_extension_). + 1. Let _attributes_ be _components_.[[Attributes]]. + 1. Let _keywords_ be _components_.[[Keywords]]. + 1. Else, + 1. Let _attributes_ be a new empty List. + 1. Let _keywords_ be a new empty List. + 1. Let _result_ be a new Record. + 1. For each element _key_ of _localeExtensionKeys_, do + 1. If _keywords_ contains an element whose [[Key]] is _key_, then + 1. Let _entry_ be the element of _keywords_ whose [[Key]] is _key_. + 1. Let _value_ be _entry_.[[Value]]. + 1. Else, + 1. Let _entry_ be ~empty~. + 1. Let _value_ be *undefined*. + 1. Assert: _options_ has a field [[<_key_>]]. + 1. Let _overrideValue_ be _options_.[[<_key_>]]. + 1. If _overrideValue_ is not *undefined*, then + 1. Set _value_ to CanonicalizeUValue(_key_, _overrideValue_). + 1. If _entry_ is not ~empty~, then + 1. Set _entry_.[[Value]] to _value_. + 1. Else, + 1. Append the Record { [[Key]]: _key_, [[Value]]: _value_ } to _keywords_. + 1. Set _result_.[[<_key_>]] to _value_. + 1. Let _locale_ be the String value that is _tag_ with any Unicode locale extension sequences removed. + 1. If _attributes_ is not empty or _keywords_ is not empty, then + 1. Set _result_.[[locale]] to InsertUnicodeExtensionAndCanonicalize(_locale_, _attributes_, _keywords_). + 1. Else, + 1. Set _result_.[[locale]] to CanonicalizeUnicodeLocaleId(_locale_). + 1. Return _result_. + +
+

GetLocaleLanguage ( diff --git a/spec/numberformat.html b/spec/numberformat.html index 64dd544c..cb0fc09e 100644 --- a/spec/numberformat.html +++ b/spec/numberformat.html @@ -64,148 +64,6 @@

Intl.NumberFormat ( [ _locales_ [ , _options_ ] ] )

1. Return ? ChainNumberFormat(_numberFormat_, NewTarget, _this_). 1. Return _numberFormat_. - - - -

- ChainNumberFormat ( - _numberFormat_: an Intl.NumberFormat, - _newTarget_: an ECMAScript language value, - _this_: an ECMAScript language value, - ): either a normal completion containing an Object or a throw completion -

-
-
- - 1. If _newTarget_ is *undefined* and ? OrdinaryHasInstance(%Intl.NumberFormat%, _this_) is *true*, then - 1. Perform ? DefinePropertyOrThrow(_this_, %Intl%.[[FallbackSymbol]], PropertyDescriptor{ [[Value]]: _numberFormat_, [[Writable]]: *false*, [[Enumerable]]: *false*, [[Configurable]]: *false* }). - 1. Return _this_. - 1. Return _numberFormat_. - -
-
-
- - -

- SetNumberFormatDigitOptions ( - _intlObj_: an Object, - _options_: an Object, - _mnfdDefault_: an integer, - _mxfdDefault_: an integer, - _notation_: a String, - ): either a normal completion containing ~unused~ or a throw completion -

-
-
description
-
It populates the internal slots of _intlObj_ that affect locale-independent number rounding (see ).
-
- - 1. Let _mnid_ be ? GetNumberOption(_options_, *"minimumIntegerDigits,"*, 1, 21, 1). - 1. Let _mnfd_ be ? Get(_options_, *"minimumFractionDigits"*). - 1. Let _mxfd_ be ? Get(_options_, *"maximumFractionDigits"*). - 1. Let _mnsd_ be ? Get(_options_, *"minimumSignificantDigits"*). - 1. Let _mxsd_ be ? Get(_options_, *"maximumSignificantDigits"*). - 1. Set _intlObj_.[[MinimumIntegerDigits]] to _mnid_. - 1. Let _roundingIncrement_ be ? GetNumberOption(_options_, *"roundingIncrement"*, 1, 5000, 1). - 1. If _roundingIncrement_ is not in « 1, 2, 5, 10, 20, 25, 50, 100, 200, 250, 500, 1000, 2000, 2500, 5000 », throw a *RangeError* exception. - 1. Let _roundingMode_ be ? GetOption(_options_, *"roundingMode"*, ~string~, « *"ceil"*, *"floor"*, *"expand"*, *"trunc"*, *"halfCeil"*, *"halfFloor"*, *"halfExpand"*, *"halfTrunc"*, *"halfEven"* », *"halfExpand"*). - 1. Let _roundingPriority_ be ? GetOption(_options_, *"roundingPriority"*, ~string~, « *"auto"*, *"morePrecision"*, *"lessPrecision"* », *"auto"*). - 1. Let _trailingZeroDisplay_ be ? GetOption(_options_, *"trailingZeroDisplay"*, ~string~, « *"auto"*, *"stripIfInteger"* », *"auto"*). - 1. NOTE: All fields required by SetNumberFormatDigitOptions have now been read from _options_. The remainder of this AO interprets the options and may throw exceptions. - 1. If _roundingIncrement_ is not 1, set _mxfdDefault_ to _mnfdDefault_. - 1. Set _intlObj_.[[RoundingIncrement]] to _roundingIncrement_. - 1. Set _intlObj_.[[RoundingMode]] to _roundingMode_. - 1. Set _intlObj_.[[TrailingZeroDisplay]] to _trailingZeroDisplay_. - 1. If _mnsd_ is *undefined* and _mxsd_ is *undefined*, let _hasSd_ be *false*. Otherwise, let _hasSd_ be *true*. - 1. If _mnfd_ is *undefined* and _mxsd_ is *undefined*, let _hasFd_ be *false*. Otherwise, let _hasFd_ be *true*. - 1. Let _needSd_ be *true*. - 1. Let _needFd_ be *true*. - 1. If _roundingPriority_ is *"auto"*, then - 1. Set _needSd_ to _hasSd_. - 1. If _needSd_ is *true*, or _hasFd_ is *false* and _notation_ is *"compact"*, then - 1. Set _needFd_ to *false*. - 1. If _needSd_ is *true*, then - 1. If _hasSd_ is *true*, then - 1. Set _intlObj_.[[MinimumSignificantDigits]] to ? DefaultNumberOption(_mnsd_, 1, 21, 1). - 1. Set _intlObj_.[[MaximumSignificantDigits]] to ? DefaultNumberOption(_mxsd_, _intlObj_.[[MinimumSignificantDigits]], 21, 21). - 1. Else, - 1. Set _intlObj_.[[MinimumSignificantDigits]] to 1. - 1. Set _intlObj_.[[MaximumSignificantDigits]] to 21. - 1. If _needFd_ is *true*, then - 1. If _hasFd_ is *true*, then - 1. Set _mnfd_ to ? DefaultNumberOption(_mnfd_, 0, 100, *undefined*). - 1. Set _mxfd_ to ? DefaultNumberOption(_mxfd_, 0, 100, *undefined*). - 1. If _mnfd_ is *undefined*, set _mnfd_ to min(_mnfdDefault_, _mxfd_). - 1. Else if _mxfd_ is *undefined*, set _mxfd_ to max(_mxfdDefault_, _mnfd_). - 1. Else if _mnfd_ is greater than _mxfd_, throw a *RangeError* exception. - 1. Set _intlObj_.[[MinimumFractionDigits]] to _mnfd_. - 1. Set _intlObj_.[[MaximumFractionDigits]] to _mxfd_. - 1. Else, - 1. Set _intlObj_.[[MinimumFractionDigits]] to _mnfdDefault_. - 1. Set _intlObj_.[[MaximumFractionDigits]] to _mxfdDefault_. - 1. If _needSd_ is *false* and _needFd_ is *false*, then - 1. Set _intlObj_.[[MinimumFractionDigits]] to 0. - 1. Set _intlObj_.[[MaximumFractionDigits]] to 0. - 1. Set _intlObj_.[[MinimumSignificantDigits]] to 1. - 1. Set _intlObj_.[[MaximumSignificantDigits]] to 2. - 1. Set _intlObj_.[[RoundingType]] to ~more-precision~. - 1. Set _intlObj_.[[ComputedRoundingPriority]] to *"morePrecision"*. - 1. Else if _roundingPriority_ is *"morePrecision"*, then - 1. Set _intlObj_.[[RoundingType]] to ~more-precision~. - 1. Set _intlObj_.[[ComputedRoundingPriority]] to *"morePrecision"*. - 1. Else if _roundingPriority_ is *"lessPrecision"*, then - 1. Set _intlObj_.[[RoundingType]] to ~less-precision~. - 1. Set _intlObj_.[[ComputedRoundingPriority]] to *"lessPrecision"*. - 1. Else if _hasSd_ is *true*, then - 1. Set _intlObj_.[[RoundingType]] to ~significant-digits~. - 1. Set _intlObj_.[[ComputedRoundingPriority]] to *"auto"*. - 1. Else, - 1. Set _intlObj_.[[RoundingType]] to ~fraction-digits~. - 1. Set _intlObj_.[[ComputedRoundingPriority]] to *"auto"*. - 1. If _roundingIncrement_ is not 1, then - 1. If _intlObj_.[[RoundingType]] is not ~fraction-digits~, throw a *TypeError* exception. - 1. If _intlObj_.[[MaximumFractionDigits]] is not _intlObj_.[[MinimumFractionDigits]], throw a *RangeError* exception. - 1. Return ~unused~. - -
- - -

- SetNumberFormatUnitOptions ( - _intlObj_: an Intl.NumberFormat, - _options_: an Object, - ): either a normal completion containing ~unused~ or a throw completion -

-
-
description
-
It resolves the user-specified options relating to units onto _intlObj_.
-
- - 1. Let _style_ be ? GetOption(_options_, *"style"*, ~string~, « *"decimal"*, *"percent"*, *"currency"*, *"unit"* », *"decimal"*). - 1. Set _intlObj_.[[Style]] to _style_. - 1. Let _currency_ be ? GetOption(_options_, *"currency"*, ~string~, ~empty~, *undefined*). - 1. If _currency_ is *undefined*, then - 1. If _style_ is *"currency"*, throw a *TypeError* exception. - 1. Else, - 1. If IsWellFormedCurrencyCode(_currency_) is *false*, throw a *RangeError* exception. - 1. Let _currencyDisplay_ be ? GetOption(_options_, *"currencyDisplay"*, ~string~, « *"code"*, *"symbol"*, *"narrowSymbol"*, *"name"* », *"symbol"*). - 1. Let _currencySign_ be ? GetOption(_options_, *"currencySign"*, ~string~, « *"standard"*, *"accounting"* », *"standard"*). - 1. Let _unit_ be ? GetOption(_options_, *"unit"*, ~string~, ~empty~, *undefined*). - 1. If _unit_ is *undefined*, then - 1. If _style_ is *"unit"*, throw a *TypeError* exception. - 1. Else, - 1. If IsWellFormedUnitIdentifier(_unit_) is *false*, throw a *RangeError* exception. - 1. Let _unitDisplay_ be ? GetOption(_options_, *"unitDisplay"*, ~string~, « *"short"*, *"narrow"*, *"long"* », *"short"*). - 1. If _style_ is *"currency"*, then - 1. Set _intlObj_.[[Currency]] to the ASCII-uppercase of _currency_. - 1. Set _intlObj_.[[CurrencyDisplay]] to _currencyDisplay_. - 1. Set _intlObj_.[[CurrencySign]] to _currencySign_. - 1. If _style_ is *"unit"*, then - 1. Set _intlObj_.[[Unit]] to _unit_. - 1. Set _intlObj_.[[UnitDisplay]] to _unitDisplay_. - 1. Return ~unused~. -
@@ -684,6 +542,148 @@

Properties of Intl.NumberFormat Instances

Abstract Operations for NumberFormat Objects

+ + +

+ ChainNumberFormat ( + _numberFormat_: an Intl.NumberFormat, + _newTarget_: an ECMAScript language value, + _this_: an ECMAScript language value, + ): either a normal completion containing an Object or a throw completion +

+
+
+ + 1. If _newTarget_ is *undefined* and ? OrdinaryHasInstance(%Intl.NumberFormat%, _this_) is *true*, then + 1. Perform ? DefinePropertyOrThrow(_this_, %Intl%.[[FallbackSymbol]], PropertyDescriptor{ [[Value]]: _numberFormat_, [[Writable]]: *false*, [[Enumerable]]: *false*, [[Configurable]]: *false* }). + 1. Return _this_. + 1. Return _numberFormat_. + +
+
+ + +

+ SetNumberFormatDigitOptions ( + _intlObj_: an Object, + _options_: an Object, + _mnfdDefault_: an integer, + _mxfdDefault_: an integer, + _notation_: a String, + ): either a normal completion containing ~unused~ or a throw completion +

+
+
description
+
It populates the internal slots of _intlObj_ that affect locale-independent number rounding (see ).
+
+ + 1. Let _mnid_ be ? GetNumberOption(_options_, *"minimumIntegerDigits,"*, 1, 21, 1). + 1. Let _mnfd_ be ? Get(_options_, *"minimumFractionDigits"*). + 1. Let _mxfd_ be ? Get(_options_, *"maximumFractionDigits"*). + 1. Let _mnsd_ be ? Get(_options_, *"minimumSignificantDigits"*). + 1. Let _mxsd_ be ? Get(_options_, *"maximumSignificantDigits"*). + 1. Set _intlObj_.[[MinimumIntegerDigits]] to _mnid_. + 1. Let _roundingIncrement_ be ? GetNumberOption(_options_, *"roundingIncrement"*, 1, 5000, 1). + 1. If _roundingIncrement_ is not in « 1, 2, 5, 10, 20, 25, 50, 100, 200, 250, 500, 1000, 2000, 2500, 5000 », throw a *RangeError* exception. + 1. Let _roundingMode_ be ? GetOption(_options_, *"roundingMode"*, ~string~, « *"ceil"*, *"floor"*, *"expand"*, *"trunc"*, *"halfCeil"*, *"halfFloor"*, *"halfExpand"*, *"halfTrunc"*, *"halfEven"* », *"halfExpand"*). + 1. Let _roundingPriority_ be ? GetOption(_options_, *"roundingPriority"*, ~string~, « *"auto"*, *"morePrecision"*, *"lessPrecision"* », *"auto"*). + 1. Let _trailingZeroDisplay_ be ? GetOption(_options_, *"trailingZeroDisplay"*, ~string~, « *"auto"*, *"stripIfInteger"* », *"auto"*). + 1. NOTE: All fields required by SetNumberFormatDigitOptions have now been read from _options_. The remainder of this AO interprets the options and may throw exceptions. + 1. If _roundingIncrement_ is not 1, set _mxfdDefault_ to _mnfdDefault_. + 1. Set _intlObj_.[[RoundingIncrement]] to _roundingIncrement_. + 1. Set _intlObj_.[[RoundingMode]] to _roundingMode_. + 1. Set _intlObj_.[[TrailingZeroDisplay]] to _trailingZeroDisplay_. + 1. If _mnsd_ is *undefined* and _mxsd_ is *undefined*, let _hasSd_ be *false*. Otherwise, let _hasSd_ be *true*. + 1. If _mnfd_ is *undefined* and _mxsd_ is *undefined*, let _hasFd_ be *false*. Otherwise, let _hasFd_ be *true*. + 1. Let _needSd_ be *true*. + 1. Let _needFd_ be *true*. + 1. If _roundingPriority_ is *"auto"*, then + 1. Set _needSd_ to _hasSd_. + 1. If _needSd_ is *true*, or _hasFd_ is *false* and _notation_ is *"compact"*, then + 1. Set _needFd_ to *false*. + 1. If _needSd_ is *true*, then + 1. If _hasSd_ is *true*, then + 1. Set _intlObj_.[[MinimumSignificantDigits]] to ? DefaultNumberOption(_mnsd_, 1, 21, 1). + 1. Set _intlObj_.[[MaximumSignificantDigits]] to ? DefaultNumberOption(_mxsd_, _intlObj_.[[MinimumSignificantDigits]], 21, 21). + 1. Else, + 1. Set _intlObj_.[[MinimumSignificantDigits]] to 1. + 1. Set _intlObj_.[[MaximumSignificantDigits]] to 21. + 1. If _needFd_ is *true*, then + 1. If _hasFd_ is *true*, then + 1. Set _mnfd_ to ? DefaultNumberOption(_mnfd_, 0, 100, *undefined*). + 1. Set _mxfd_ to ? DefaultNumberOption(_mxfd_, 0, 100, *undefined*). + 1. If _mnfd_ is *undefined*, set _mnfd_ to min(_mnfdDefault_, _mxfd_). + 1. Else if _mxfd_ is *undefined*, set _mxfd_ to max(_mxfdDefault_, _mnfd_). + 1. Else if _mnfd_ is greater than _mxfd_, throw a *RangeError* exception. + 1. Set _intlObj_.[[MinimumFractionDigits]] to _mnfd_. + 1. Set _intlObj_.[[MaximumFractionDigits]] to _mxfd_. + 1. Else, + 1. Set _intlObj_.[[MinimumFractionDigits]] to _mnfdDefault_. + 1. Set _intlObj_.[[MaximumFractionDigits]] to _mxfdDefault_. + 1. If _needSd_ is *false* and _needFd_ is *false*, then + 1. Set _intlObj_.[[MinimumFractionDigits]] to 0. + 1. Set _intlObj_.[[MaximumFractionDigits]] to 0. + 1. Set _intlObj_.[[MinimumSignificantDigits]] to 1. + 1. Set _intlObj_.[[MaximumSignificantDigits]] to 2. + 1. Set _intlObj_.[[RoundingType]] to ~more-precision~. + 1. Set _intlObj_.[[ComputedRoundingPriority]] to *"morePrecision"*. + 1. Else if _roundingPriority_ is *"morePrecision"*, then + 1. Set _intlObj_.[[RoundingType]] to ~more-precision~. + 1. Set _intlObj_.[[ComputedRoundingPriority]] to *"morePrecision"*. + 1. Else if _roundingPriority_ is *"lessPrecision"*, then + 1. Set _intlObj_.[[RoundingType]] to ~less-precision~. + 1. Set _intlObj_.[[ComputedRoundingPriority]] to *"lessPrecision"*. + 1. Else if _hasSd_ is *true*, then + 1. Set _intlObj_.[[RoundingType]] to ~significant-digits~. + 1. Set _intlObj_.[[ComputedRoundingPriority]] to *"auto"*. + 1. Else, + 1. Set _intlObj_.[[RoundingType]] to ~fraction-digits~. + 1. Set _intlObj_.[[ComputedRoundingPriority]] to *"auto"*. + 1. If _roundingIncrement_ is not 1, then + 1. If _intlObj_.[[RoundingType]] is not ~fraction-digits~, throw a *TypeError* exception. + 1. If _intlObj_.[[MaximumFractionDigits]] is not _intlObj_.[[MinimumFractionDigits]], throw a *RangeError* exception. + 1. Return ~unused~. + +
+ + +

+ SetNumberFormatUnitOptions ( + _intlObj_: an Intl.NumberFormat, + _options_: an Object, + ): either a normal completion containing ~unused~ or a throw completion +

+
+
description
+
It resolves the user-specified options relating to units onto _intlObj_.
+
+ + 1. Let _style_ be ? GetOption(_options_, *"style"*, ~string~, « *"decimal"*, *"percent"*, *"currency"*, *"unit"* », *"decimal"*). + 1. Set _intlObj_.[[Style]] to _style_. + 1. Let _currency_ be ? GetOption(_options_, *"currency"*, ~string~, ~empty~, *undefined*). + 1. If _currency_ is *undefined*, then + 1. If _style_ is *"currency"*, throw a *TypeError* exception. + 1. Else, + 1. If IsWellFormedCurrencyCode(_currency_) is *false*, throw a *RangeError* exception. + 1. Let _currencyDisplay_ be ? GetOption(_options_, *"currencyDisplay"*, ~string~, « *"code"*, *"symbol"*, *"narrowSymbol"*, *"name"* », *"symbol"*). + 1. Let _currencySign_ be ? GetOption(_options_, *"currencySign"*, ~string~, « *"standard"*, *"accounting"* », *"standard"*). + 1. Let _unit_ be ? GetOption(_options_, *"unit"*, ~string~, ~empty~, *undefined*). + 1. If _unit_ is *undefined*, then + 1. If _style_ is *"unit"*, throw a *TypeError* exception. + 1. Else, + 1. If IsWellFormedUnitIdentifier(_unit_) is *false*, throw a *RangeError* exception. + 1. Let _unitDisplay_ be ? GetOption(_options_, *"unitDisplay"*, ~string~, « *"short"*, *"narrow"*, *"long"* », *"short"*). + 1. If _style_ is *"currency"*, then + 1. Set _intlObj_.[[Currency]] to the ASCII-uppercase of _currency_. + 1. Set _intlObj_.[[CurrencyDisplay]] to _currencyDisplay_. + 1. Set _intlObj_.[[CurrencySign]] to _currencySign_. + 1. If _style_ is *"unit"*, then + 1. Set _intlObj_.[[Unit]] to _unit_. + 1. Set _intlObj_.[[UnitDisplay]] to _unitDisplay_. + 1. Return ~unused~. + +
+

CurrencyDigits (