From 5afbb89415c1007ff76993576aa355ae248f55de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Bargull?= Date: Thu, 12 Oct 2023 10:24:39 +0200 Subject: [PATCH] Editorial: Modernise spec to use structured headers and correct number representations (#822) Sweeping changes across the entire spec to update ECMA-402 to use structured headers as used in ECMA-262 Also contains related refactoring, plus updates to represent numbers correctly/consistently --- package-lock.json | 44 +- package.json | 6 +- spec/collator.html | 55 ++- spec/datetimeformat.html | 372 ++++++++++------ spec/displaynames.html | 12 +- spec/index.html | 2 - spec/listformat.html | 139 +++--- spec/locale-sensitive-functions.html | 32 +- spec/locale.html | 156 +++++-- spec/locales-currencies-tz.html | 147 ++++--- spec/negotiation.html | 292 +++++++------ spec/numberformat.html | 621 +++++++++++++++++---------- spec/pluralrules.html | 149 ++++--- spec/relativetimeformat.html | 133 +++--- spec/segmenter.html | 84 ++-- 15 files changed, 1398 insertions(+), 846 deletions(-) diff --git a/package-lock.json b/package-lock.json index 943a86d7..b47fc0c6 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,8 +9,8 @@ "version": "9.0.0", "license": "SEE LICENSE IN https://tc39.es/ecma402/#sec-copyright-and-software-license", "dependencies": { - "@tc39/ecma262-biblio": "2.1.2458", - "ecmarkup": "^16.0.0" + "@tc39/ecma262-biblio": "2.1.2638", + "ecmarkup": "^18.0.0" }, "devDependencies": {} }, @@ -208,9 +208,9 @@ } }, "node_modules/@tc39/ecma262-biblio": { - "version": "2.1.2458", - "resolved": "https://registry.npmjs.org/@tc39/ecma262-biblio/-/ecma262-biblio-2.1.2458.tgz", - "integrity": "sha512-Gallnt+z+iCITiDGrcZIYsF/KfN21qt+owKhQWiTvzwCtnq3f+2nCZkjxO1599DUOYk/QD0B8k9tvAn4jsbgng==" + "version": "2.1.2638", + "resolved": "https://registry.npmjs.org/@tc39/ecma262-biblio/-/ecma262-biblio-2.1.2638.tgz", + "integrity": "sha512-644cVhPBYBY5OGg5HTsEX9HqHMxkq0J+kf/BPdI715NAREi66RRpZzgNc4IdflKLfZou/U+vNtS7GYxfsHOu2g==" }, "node_modules/@tootallnate/once": { "version": "2.0.0", @@ -493,23 +493,23 @@ } }, "node_modules/ecmarkdown": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/ecmarkdown/-/ecmarkdown-7.2.0.tgz", - "integrity": "sha512-p0C4SJCvnvtm0y9gPhXBb5DlNbHsNS44ihVKBw3MXviZG2QQpZNH4z/3PbkpgECOjKOeZI+m84ISHVV9WLECFQ==", + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/ecmarkdown/-/ecmarkdown-8.1.0.tgz", + "integrity": "sha512-dx6cM6RFjzAXkWr2KQRikED4gy70NFQ0vTI4XUQM/LWcjUYRJUbGdd7nd++trXi5az1JSe49TeeCIVMKDXOtcQ==", "dependencies": { "escape-html": "^1.0.1" } }, "node_modules/ecmarkup": { - "version": "16.0.0", - "resolved": "https://registry.npmjs.org/ecmarkup/-/ecmarkup-16.0.0.tgz", - "integrity": "sha512-12TCAQG072ywauddgoah7N9/K8rA8v3t3MJsnSbPZDM98bNG224x5ShMxBkdVaGf5ncENTFlVom58TGCW5V0wQ==", + "version": "18.0.0", + "resolved": "https://registry.npmjs.org/ecmarkup/-/ecmarkup-18.0.0.tgz", + "integrity": "sha512-VSItKQ+39dv1FeR1YbGGlJ/rx17wsPSkS7morrOCwLGHh+7ehy89hao+rQ0/ptiBAN3nbytXzwUBUTC3XNmxaA==", "dependencies": { "chalk": "^4.1.2", "command-line-args": "^5.2.0", "command-line-usage": "^6.1.1", "dedent-js": "^1.0.1", - "ecmarkdown": "^7.2.0", + "ecmarkdown": "^8.1.0", "eslint-formatter-codeframe": "^7.32.1", "fast-glob": "^3.2.7", "grammarkdown": "^3.2.0", @@ -1556,9 +1556,9 @@ } }, "@tc39/ecma262-biblio": { - "version": "2.1.2458", - "resolved": "https://registry.npmjs.org/@tc39/ecma262-biblio/-/ecma262-biblio-2.1.2458.tgz", - "integrity": "sha512-Gallnt+z+iCITiDGrcZIYsF/KfN21qt+owKhQWiTvzwCtnq3f+2nCZkjxO1599DUOYk/QD0B8k9tvAn4jsbgng==" + "version": "2.1.2638", + "resolved": "https://registry.npmjs.org/@tc39/ecma262-biblio/-/ecma262-biblio-2.1.2638.tgz", + "integrity": "sha512-644cVhPBYBY5OGg5HTsEX9HqHMxkq0J+kf/BPdI715NAREi66RRpZzgNc4IdflKLfZou/U+vNtS7GYxfsHOu2g==" }, "@tootallnate/once": { "version": "2.0.0", @@ -1774,23 +1774,23 @@ "integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==" }, "ecmarkdown": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/ecmarkdown/-/ecmarkdown-7.2.0.tgz", - "integrity": "sha512-p0C4SJCvnvtm0y9gPhXBb5DlNbHsNS44ihVKBw3MXviZG2QQpZNH4z/3PbkpgECOjKOeZI+m84ISHVV9WLECFQ==", + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/ecmarkdown/-/ecmarkdown-8.1.0.tgz", + "integrity": "sha512-dx6cM6RFjzAXkWr2KQRikED4gy70NFQ0vTI4XUQM/LWcjUYRJUbGdd7nd++trXi5az1JSe49TeeCIVMKDXOtcQ==", "requires": { "escape-html": "^1.0.1" } }, "ecmarkup": { - "version": "16.0.0", - "resolved": "https://registry.npmjs.org/ecmarkup/-/ecmarkup-16.0.0.tgz", - "integrity": "sha512-12TCAQG072ywauddgoah7N9/K8rA8v3t3MJsnSbPZDM98bNG224x5ShMxBkdVaGf5ncENTFlVom58TGCW5V0wQ==", + "version": "18.0.0", + "resolved": "https://registry.npmjs.org/ecmarkup/-/ecmarkup-18.0.0.tgz", + "integrity": "sha512-VSItKQ+39dv1FeR1YbGGlJ/rx17wsPSkS7morrOCwLGHh+7ehy89hao+rQ0/ptiBAN3nbytXzwUBUTC3XNmxaA==", "requires": { "chalk": "^4.1.2", "command-line-args": "^5.2.0", "command-line-usage": "^6.1.1", "dedent-js": "^1.0.1", - "ecmarkdown": "^7.2.0", + "ecmarkdown": "^8.1.0", "eslint-formatter-codeframe": "^7.32.1", "fast-glob": "^3.2.7", "grammarkdown": "^3.2.0", diff --git a/package.json b/package.json index ab99c113..ce3a9ca6 100644 --- a/package.json +++ b/package.json @@ -7,7 +7,7 @@ "clean": "rm -rf out", "build-to": "ecmarkup --verbose --load-biblio @tc39/ecma262-biblio spec/index.html", "prebuild-only": "npm run clean && mkdir out && cp -R img out", - "build-only": "npm run build-to -- out/index.html --css-out out/ecmarkup.css --js-out out/ecmarkup.js", + "build-only": "npm run build-to -- out/index.html --assets-dir=out", "build": "npm run build-only -- --lint-spec --strict", "build-for-pdf": "npm run build -- --old-toc", "test": "npm run build-to -- --lint-spec /dev/null", @@ -18,8 +18,8 @@ "license": "SEE LICENSE IN https://tc39.es/ecma402/#sec-copyright-and-software-license", "homepage": "https://tc39.es/ecma402/", "dependencies": { - "ecmarkup": "^16.0.0", - "@tc39/ecma262-biblio": "2.1.2458" + "ecmarkup": "^18.0.0", + "@tc39/ecma262-biblio": "2.1.2638" }, "devDependencies": { } diff --git a/spec/collator.html b/spec/collator.html index 55c92a6b..bdfb845a 100644 --- a/spec/collator.html +++ b/spec/collator.html @@ -25,13 +25,18 @@

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

- -

InitializeCollator ( _collator_, _locales_, _options_ )

- -

- The abstract operation InitializeCollator accepts the arguments _collator_ (which must be an object), _locales_, and _options_. It initializes _collator_ as a Collator object. The following steps are taken: -

- + +

+ InitializeCollator ( + _collator_: an Intl.Collator, + _locales_: an ECMAScript language value, + _options_: an ECMAScript language value, + ): either a normal completion containing _collator_ or a throw completion +

+
+
description
+
It initializes _collator_ as a Collator object.
+
1. Let _requestedLocales_ be ? CanonicalizeLocaleList(_locales_). 1. Set _options_ to ? CoerceOptionsToObject(_options_). @@ -50,15 +55,15 @@

InitializeCollator ( _collator_, _locales_, _options_ )

1. Set _opt_.[[co]] to _collation_. 1. Let _numeric_ be ? GetOption(_options_, *"numeric"*, ~boolean~, ~empty~, *undefined*). 1. If _numeric_ is not *undefined*, then - 1. Let _numeric_ be ! ToString(_numeric_). + 1. Set _numeric_ to ! ToString(_numeric_). 1. Set _opt_.[[kn]] to _numeric_. 1. Let _caseFirst_ be ? GetOption(_options_, *"caseFirst"*, ~string~, « *"upper"*, *"lower"*, *"false"* », *undefined*). 1. Set _opt_.[[kf]] to _caseFirst_. 1. Let _relevantExtensionKeys_ be %Collator%.[[RelevantExtensionKeys]]. 1. Let _r_ be ResolveLocale(%Collator%.[[AvailableLocales]], _requestedLocales_, _opt_, _relevantExtensionKeys_, _localeData_). 1. Set _collator_.[[Locale]] to _r_.[[locale]]. - 1. Let _collation_ be _r_.[[co]]. - 1. If _collation_ is *null*, let _collation_ be *"default"*. + 1. Set _collation_ to _r_.[[co]]. + 1. If _collation_ is *null*, set _collation_ to *"default"*. 1. Set _collator_.[[Collation]] to _collation_. 1. If _relevantExtensionKeys_ contains *"kn"*, then 1. Set _collator_.[[Numeric]] to SameValue(_r_.[[kn]], *"true"*). @@ -67,11 +72,11 @@

InitializeCollator ( _collator_, _locales_, _options_ )

1. Let _sensitivity_ be ? GetOption(_options_, *"sensitivity"*, ~string~, « *"base"*, *"accent"*, *"case"*, *"variant"* », *undefined*). 1. If _sensitivity_ is *undefined*, then 1. If _usage_ is *"sort"*, then - 1. Let _sensitivity_ be *"variant"*. + 1. Set _sensitivity_ to *"variant"*. 1. Else, 1. Let _dataLocale_ be _r_.[[dataLocale]]. 1. Let _dataLocaleData_ be _localeData_.[[<_dataLocale_>]]. - 1. Let _sensitivity_ be _dataLocaleData_.[[sensitivity]]. + 1. Set _sensitivity_ to _dataLocaleData_.[[sensitivity]]. 1. Set _collator_.[[Sensitivity]] to _sensitivity_. 1. Let _ignorePunctuation_ be ? GetOption(_options_, *"ignorePunctuation"*, ~boolean~, ~empty~, *false*). 1. Set _collator_.[[IgnorePunctuation]] to _ignorePunctuation_. @@ -207,15 +212,25 @@

Collator Compare Functions

1. Return CompareStrings(_collator_, _X_, _Y_).
-

The *"length"* property of a Collator compare function is 2.

+

The *"length"* property of a Collator compare function is *2*๐”ฝ.

- -

CompareStrings ( _collator_, _x_, _y_ )

- -

- When the CompareStrings abstract operation is called with arguments _collator_ (which must be an object initialized as a Collator), _x_ and _y_ (which must be String values), it returns a Number other than *NaN* representing the result of an implementation-defined locale-sensitive String comparison of _x_ with _y_. The result is intended to correspond with a sort order of String values according to the effective locale and collation options of _collator_, and will be negative when _x_ is ordered before _y_, positive when _x_ is ordered after _y_, and zero in all other cases (representing no relative ordering between _x_ and _y_). String values must be interpreted as UTF-16 code unit sequences as described in es2024, , and a surrogate pair (a code unit in the range 0xD800 to 0xDBFF followed by a code unit in the range 0xDC00 to 0xDFFF) within a string must be interpreted as the corresponding code point. -

+ +

+ CompareStrings ( + _collator_: an Intl.Collator, + _x_: a String, + _y_: a String, + ): a Number, but not *NaN* +

+
+
description
+
+ The returned Number represents the result of an implementation-defined locale-sensitive String comparison of _x_ with _y_. + The result is intended to correspond with a sort order of String values according to the effective locale and collation options of _collator_, and will be negative when _x_ is ordered before _y_, positive when _x_ is ordered after _y_, and zero in all other cases (representing no relative ordering between _x_ and _y_). + String values must be interpreted as UTF-16 code unit sequences as described in es2024, , and a surrogate pair (a code unit in the range 0xD800 to 0xDBFF followed by a code unit in the range 0xDC00 to 0xDFFF) within a string must be interpreted as the corresponding code point. +
+

Behaviour as described below depends upon locale-sensitive identification of the sequence of collation elements for a string, in particular "base letters", and different base letters always compare as unequal (causing the strings containing them to also compare as unequal). Results of comparing variations of the same base letter with different case, diacritic marks, or potentially other aspects further depends upon _collator_.[[Sensitivity]] as follows: @@ -302,7 +317,7 @@

Intl.Collator.prototype.resolvedOptions ( )

1. If the current row has an Extension Key value, then 1. Let _extensionKey_ be the Extension Key value of the current row. 1. If %Collator%.[[RelevantExtensionKeys]] does not contain _extensionKey_, then - 1. Let _v_ be *undefined*. + 1. Set _v_ to *undefined*. 1. If _v_ is not *undefined*, then 1. Perform ! CreateDataPropertyOrThrow(_options_, _p_, _v_). 1. Return _options_. diff --git a/spec/datetimeformat.html b/spec/datetimeformat.html index 31c0245e..77e517f0 100644 --- a/spec/datetimeformat.html +++ b/spec/datetimeformat.html @@ -25,8 +25,16 @@

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

- -

ChainDateTimeFormat ( _dateTimeFormat_, _newTarget_, _this_ )

+ +

+ 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(%DateTimeFormat%, _this_) is *true*, then 1. Perform ? DefinePropertyOrThrow(_this_, %Intl%.[[FallbackSymbol]], PropertyDescriptor{ [[Value]]: _dateTimeFormat_, [[Writable]]: *false*, [[Enumerable]]: *false*, [[Configurable]]: *false* }). @@ -90,7 +98,7 @@

1. Set _dateTimeFormat_.[[HourCycle]] to _hc_. 1. Let _timeZone_ be ? Get(_options_, *"timeZone"*). 1. If _timeZone_ is *undefined*, then - 1. Set _timeZone_ to DefaultTimeZone(). + 1. Set _timeZone_ to SystemTimeZoneIdentifier(). 1. Else, 1. Set _timeZone_ to ? ToString(_timeZone_). 1. If IsTimeZoneOffsetString(_timeZone_) is *true*, then @@ -119,7 +127,7 @@

1. Set _formatOptions_.[[<_prop_>]] to _value_. 1. If _value_ is not *undefined*, then 1. Set _hasExplicitFormatComponents_ to *true*. - 1. Let _matcher_ be ? GetOption(_options_, *"formatMatcher"*, ~string~, « *"basic"*, *"best fit"* », *"best fit"*). + 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*). @@ -138,11 +146,11 @@

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*, let _needDefaults_ be *false*. + 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*, let _needDefaults_ be *false*. + 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"*. @@ -150,7 +158,7 @@

1. For each property name _prop_ of « *"hour"*, *"minute"*, *"second"* », do 1. Set _formatOptions_.[[<_prop_>]] to *"numeric"*. 1. Let _formats_ be _dataLocaleData_.[[formats]].[[<_resolvedCalendar_>]]. - 1. If _matcher_ is *"basic"*, then + 1. If _formatMatcher_ is *"basic"*, then 1. Let _bestFormat_ be BasicFormatMatcher(_formatOptions_, _formats_). 1. Else, 1. Let _bestFormat_ be BestFitFormatMatcher(_formatOptions_, _formats_). @@ -577,18 +585,19 @@

Intl.DateTimeFormat.prototype.resolvedOptions ( )

1. Perform ? RequireInternalSlot(_dtf_, [[InitializedDateTimeFormat]]). 1. Let _options_ be OrdinaryObjectCreate(%Object.prototype%). 1. For each row of , except the header row, in table order, do + 1. Let _v_ be the value of _dtf_'s internal slot whose name is the Internal Slot value of the current row. 1. Let _p_ be the Property value of the current row. - 1. If _p_ is *"hour12"*, then - 1. Let _hc_ be _dtf_.[[HourCycle]]. - 1. If _hc_ is *"h11"* or *"h12"*, let _v_ be *true*. - 1. Else if, _hc_ is *"h23"* or *"h24"*, let _v_ be *false*. - 1. Else, let _v_ be *undefined*. - 1. Else, - 1. Let _v_ be the value of _dtf_'s internal slot whose name is the Internal Slot value of the current row. 1. If the Internal Slot value of the current row is an Internal Slot value in , then 1. If _dtf_.[[DateStyle]] is not *undefined* or _dtf_.[[TimeStyle]] is not *undefined*, then - 1. Let _v_ be *undefined*. + 1. Set _v_ to *undefined*. 1. If _v_ is not *undefined*, then + 1. If there is a Conversion value in the current row, then + 1. Let _conversion_ be the Conversion value of the current row. + 1. If _conversion_ is ~hour12~, then + 1. If _v_ is *"h11"* or *"h12"*, set _v_ to *true*. Otherwise, set _v_ to *false*. + 1. Else, + 1. Assert: _conversion_ is ~number~. + 1. Set _v_ to ๐”ฝ(_v_). 1. Perform ! CreateDataPropertyOrThrow(_options_, _p_, _v_). 1. Return _options_.
@@ -600,83 +609,103 @@

Intl.DateTimeFormat.prototype.resolvedOptions ( )

Internal Slot Property + Conversion [[Locale]] *"locale"* + [[Calendar]] *"calendar"* + [[NumberingSystem]] *"numberingSystem"* + [[TimeZone]] *"timeZone"* + [[HourCycle]] *"hourCycle"* + - + [[HourCycle]] *"hour12"* + ~hour12~ [[Weekday]] *"weekday"* + [[Era]] *"era"* + [[Year]] *"year"* + [[Month]] *"month"* + [[Day]] *"day"* + [[DayPeriod]] *"dayPeriod"* + [[Hour]] *"hour"* + [[Minute]] *"minute"* + [[Second]] *"second"* + [[FractionalSecondDigits]] *"fractionalSecondDigits"* + ~number~ [[TimeZoneName]] *"timeZoneName"* + [[DateStyle]] *"dateStyle"* + [[TimeStyle]] *"timeStyle"* + @@ -716,7 +745,7 @@

Properties of Intl.DateTimeFormat Instances

  • [[NumberingSystem]] is a String value representing the Unicode Number System Identifier used for formatting.
  • [[TimeZone]] is a String value used for formatting that is either a time zone identifier from the IANA Time Zone Database or a UTC offset in ISO 8601 extended format.
  • [[Weekday]], [[Era]], [[Year]], [[Month]], [[Day]], [[DayPeriod]], [[Hour]], [[Minute]], [[Second]], [[TimeZoneName]] are each either *undefined*, indicating that the component is not used for formatting, or one of the String values given in , indicating how the component should be presented in the formatted output.
  • -
  • [[FractionalSecondDigits]] is either *undefined* or a positive, non-zero integer Number value indicating the fraction digits to be used for fractional seconds. Numbers will be rounded or padded with trailing zeroes if necessary.
  • +
  • [[FractionalSecondDigits]] is either *undefined* or a positive, non-zero integer indicating the fraction digits to be used for fractional seconds. Numbers will be rounded or padded with trailing zeroes if necessary.
  • [[HourCycle]] is a String value indicating whether the 12-hour format (*"h11"*, *"h12"*) or the 24-hour format (*"h23"*, *"h24"*) should be used. *"h11"* and *"h23"* start with hour 0 and go up to 11 and 23 respectively. *"h12"* and *"h24"* start with hour 1 and go up to 12 and 24. [[HourCycle]] is only used when [[Hour]] is not *undefined*.
  • [[DateStyle]], [[TimeStyle]] are each either *undefined*, or a String value with values *"full"*, *"long"*, *"medium"*, or *"short"*.
  • [[Pattern]] is a String value as described in .
  • @@ -793,7 +822,7 @@

    Abstract Operations for DateTimeFormat Objects

    [[FractionalSecondDigits]] *"fractionalSecondDigits"* - *1*๐”ฝ, *2*๐”ฝ, *3*๐”ฝ + 1, 2, 3 [[TimeZoneName]] @@ -803,10 +832,20 @@

    Abstract Operations for DateTimeFormat Objects

    - -

    DateTimeStyleFormat ( _dateStyle_, _timeStyle_, _styles_ )

    -

    The DateTimeStyleFormat abstract operation accepts arguments _dateStyle_ and _timeStyle_, which are each either *undefined*, *"full"*, *"long"*, *"medium"*, or *"short"*, at least one of which is not *undefined*, and _styles_, which is a record from %DateTimeFormat%.[[LocaleData]].[[<_locale_>]].[[styles]].[[<_calendar_>]] for some locale _locale_ and calendar _calendar_. It returns the appropriate format record for date time formatting based on the parameters.

    + +

    + DateTimeStyleFormat ( + _dateStyle_: *"full"*, *"long"*, *"medium"*, *"short"*, or *undefined*, + _timeStyle_: *"full"*, *"long"*, *"medium"*, *"short"*, or *undefined*, + _styles_: a Record, + ): a Record +

    +
    +
    description
    +
    _styles_ is a record from %DateTimeFormat%.[[LocaleData]].[[<_locale_>]].[[styles]].[[<_calendar_>]] for some locale _locale_ and calendar _calendar_. It returns the appropriate format record for date time formatting based on the parameters.
    +
    + 1. Assert: _dateStyle_ is not *undefined* or _timeStyle_ is not *undefined*. 1. If _timeStyle_ is not *undefined*, then 1. Assert: _timeStyle_ is one of *"full"*, *"long"*, *"medium"*, or *"short"*. 1. Let _timeFormat_ be _styles_.[[TimeFormat]].[[<_timeStyle_>]]. @@ -835,13 +874,15 @@

    DateTimeStyleFormat ( _dateStyle_, _timeStyle_, _styles_ )

    - -

    BasicFormatMatcher ( _options_, _formats_ )

    - -

    - When the BasicFormatMatcher abstract operation is called with two arguments _options_ and _formats_, the following steps are taken: -

    - + +

    + BasicFormatMatcher ( + _options_: a Record, + _formats_: a List of Records, + ): a Record +

    +
    +
    1. Let _removalPenalty_ be 120. 1. Let _additionPenalty_ be 20. @@ -850,7 +891,7 @@

    BasicFormatMatcher ( _options_, _formats_ )

    1. Let _shortLessPenalty_ be 6. 1. Let _shortMorePenalty_ be 3. 1. Let _offsetPenalty_ be 1. - 1. Let _bestScore_ be -*Infinity*. + 1. Let _bestScore_ be -โˆž. 1. Let _bestFormat_ be *undefined*. 1. Assert: Type(_formats_) is List. 1. For each element _format_ of _formats_, do @@ -858,8 +899,10 @@

    BasicFormatMatcher ( _options_, _formats_ )

    1. For each property name _property_ shown in , do 1. If _options_ has a field [[<_property_>]], let _optionsProp_ be _options_.[[<_property_>]]; else let _optionsProp_ be *undefined*. 1. If _format_ has a field [[<_property_>]], let _formatProp_ be _format_.[[<_property_>]]; else let _formatProp_ be *undefined*. - 1. If _optionsProp_ is *undefined* and _formatProp_ is not *undefined*, set _score_ to _score_ - _additionPenalty_. - 1. Else if _optionsProp_ is not *undefined* and _formatProp_ is *undefined*, set _score_ to _score_ - _removalPenalty_. + 1. If _optionsProp_ is *undefined* and _formatProp_ is not *undefined*, then + 1. Set _score_ to _score_ - _additionPenalty_. + 1. Else if _optionsProp_ is not *undefined* and _formatProp_ is *undefined*, then + 1. Set _score_ to _score_ - _removalPenalty_. 1. Else if _property_ is *"timeZoneName"*, then 1. If _optionsProp_ is *"short"* or *"shortGeneric"*, then 1. If _formatProp_ is *"shortOffset"*, set _score_ to _score_ - _offsetPenalty_. @@ -867,18 +910,21 @@

    BasicFormatMatcher ( _options_, _formats_ )

    1. Else if _optionsProp_ is *"short"* and _formatProp_ is *"long"*, set _score_ to _score_ - _shortMorePenalty_. 1. Else if _optionsProp_ is *"shortGeneric"* and _formatProp_ is *"longGeneric"*, set _score_ to _score - _shortMorePenalty_. 1. Else if _optionsProp_ ≠ _formatProp_, set _score_ to _score_ - _removalPenalty_. - 1. Else if _optionsProp_ is *"shortOffset"* and _formatProp_ is *"longOffset"*, set _score_ to _score_ - _shortMorePenalty_. + 1. Else if _optionsProp_ is *"shortOffset"* and _formatProp_ is *"longOffset"*, then + 1. Set _score_ to _score_ - _shortMorePenalty_. 1. Else if _optionsProp_ is *"long"* or *"longGeneric"*, then 1. If _formatProp_ is *"longOffset"*, set _score_ to _score_ - _offsetPenalty_. 1. Else if _formatProp_ is *"shortOffset"*, set _score_ to _score_ - (_offsetPenalty_ + _longLessPenalty_). 1. Else if _optionsProp_ is *"long"* and _formatProp_ is *"short"*, set _score_ to _score_ - _longLessPenalty_. - 1. Else if _optionsProp_ is *"longGeneric"* and _formatProp_ is *"shortGeneric"*, set _score_ to _score - _longLessPenalty_. + 1. Else if _optionsProp_ is *"longGeneric"* and _formatProp_ is *"shortGeneric"*, set _score_ to _score_ - _longLessPenalty_. 1. Else if _optionsProp_ ≠ _formatProp_, set _score_ to _score_ - _removalPenalty_. - 1. Else if _optionsProp_ is *"longOffset"* and _formatProp_ is *"shortOffset"*, set _score_ to _score_ - _longLessPenalty_. - 1. Else if _optionsProp_ ≠ _formatProp_, set _score_ to _score_ - _removalPenalty_. + 1. Else if _optionsProp_ is *"longOffset"* and _formatProp_ is *"shortOffset"*, then + 1. Set _score_ to _score_ - _longLessPenalty_. + 1. Else if _optionsProp_ ≠ _formatProp_, then + 1. Set _score_ to _score_ - _removalPenalty_. 1. Else if _optionsProp_ ≠ _formatProp_, then 1. If _property_ is *"fractionalSecondDigits"*, then - 1. Let _values_ be « *1*๐”ฝ, *2*๐”ฝ, *3*๐”ฝ ». + 1. Let _values_ be « 1, 2, 3 ». 1. Else, 1. Let _values_ be « *"2-digit"*, *"numeric"*, *"narrow"*, *"short"*, *"long"* ». 1. Let _optionsPropIndex_ be the index of _optionsProp_ within _values_. @@ -889,18 +935,23 @@

    BasicFormatMatcher ( _options_, _formats_ )

    1. Else if _delta_ = -1, set _score_ to _score_ - _shortLessPenalty_. 1. Else if _delta_ = -2, set _score_ to _score_ - _longLessPenalty_. 1. If _score_ > _bestScore_, then - 1. Let _bestScore_ be _score_. - 1. Let _bestFormat_ be _format_. + 1. Set _bestScore_ to _score_. + 1. Set _bestFormat_ to _format_. 1. Return _bestFormat_.
    - -

    BestFitFormatMatcher ( _options_, _formats_ )

    - -

    - When the BestFitFormatMatcher abstract operation is called with two arguments _options_ and _formats_, it performs implementation dependent steps, which should return a set of component representations that a typical user of the selected locale would perceive as at least as good as the one returned by BasicFormatMatcher. -

    + +

    + BestFitFormatMatcher ( + _options_: a Record, + _formats_: a List of Records, + ): a Record +

    +
    +
    description
    +
    It returns a set of component representations that a typical user of the selected locale would perceive as at least as good as the one returned by BasicFormatMatcher.
    +
    @@ -920,34 +971,40 @@

    DateTime Format Functions

    - The *"length"* property of a DateTime format function is 1. + The *"length"* property of a DateTime format function is *1*๐”ฝ.

    - -

    FormatDateTimePattern ( _dateTimeFormat_, _patternParts_, _x_, _rangeFormatOptions_ )

    - -

    - The FormatDateTimePattern abstract operation is called with arguments _dateTimeFormat_ (which must be an object initialized as a DateTimeFormat), _patternParts_ (which is a list of Records as returned by PartitionPattern), _x_ (which must be a Number value), and _rangeFormatOptions_ (which is a range pattern Record as used in [[rangePattern]] or *undefined*), interprets _x_ as a time value as specified in es2024, , and creates the corresponding parts according _pattern_ and to the effective locale and the formatting options of _dateTimeFormat_ and _rangeFormatOptions_. The following steps are taken: -

    - + +

    + FormatDateTimePattern ( + _dateTimeFormat_: an Intl.DateTimeFormat, + _patternParts_: a List of Records as returned by PartitionPattern, + _x_: a Number, + _rangeFormatOptions_: a range pattern Record as used in [[rangePattern]], or *undefined*, + ): either a normal completion containing a List of Records with fields [[Type]] (a String) and [[Value]] (a String), or a throw completion +

    +
    +
    description
    +
    It interprets _x_ as a time value as specified in es2024, , and creates the corresponding parts according _pattern_ and to the effective locale and the formatting options of _dateTimeFormat_ and _rangeFormatOptions_.
    +
    1. Let _x_ be TimeClip(_x_). 1. If _x_ is *NaN*, throw a *RangeError* exception. 1. Let _locale_ be _dateTimeFormat_.[[Locale]]. 1. Let _nfOptions_ be OrdinaryObjectCreate(*null*). 1. Perform ! CreateDataPropertyOrThrow(_nfOptions_, *"useGrouping"*, *false*). - 1. Let _nf_ be ? Construct(%NumberFormat%, « _locale_, _nfOptions_ »). + 1. Let _nf_ be ! Construct(%NumberFormat%, « _locale_, _nfOptions_ »). 1. Let _nf2Options_ be OrdinaryObjectCreate(*null*). - 1. Perform ! CreateDataPropertyOrThrow(_nf2Options_, *"minimumIntegerDigits"*, 2). + 1. Perform ! CreateDataPropertyOrThrow(_nf2Options_, *"minimumIntegerDigits"*, *2*๐”ฝ). 1. Perform ! CreateDataPropertyOrThrow(_nf2Options_, *"useGrouping"*, *false*). - 1. Let _nf2_ be ? Construct(%NumberFormat%, « _locale_, _nf2Options_ »). + 1. Let _nf2_ be ! Construct(%NumberFormat%, « _locale_, _nf2Options_ »). 1. Let _fractionalSecondDigits_ be _dateTimeFormat_.[[FractionalSecondDigits]]. 1. If _fractionalSecondDigits_ is not *undefined*, then 1. Let _nf3Options_ be OrdinaryObjectCreate(*null*). - 1. Perform ! CreateDataPropertyOrThrow(_nf3Options_, *"minimumIntegerDigits"*, _fractionalSecondDigits_). + 1. Perform ! CreateDataPropertyOrThrow(_nf3Options_, *"minimumIntegerDigits"*, ๐”ฝ(_fractionalSecondDigits_)). 1. Perform ! CreateDataPropertyOrThrow(_nf3Options_, *"useGrouping"*, *false*). - 1. Let _nf3_ be ? Construct(%NumberFormat%, « _locale_, _nf3Options_ »). + 1. Let _nf3_ be ! Construct(%NumberFormat%, « _locale_, _nf3Options_ »). 1. Let _tm_ be ToLocalTime(โ„ค(โ„(_x_) × 106), _dateTimeFormat_.[[Calendar]], _dateTimeFormat_.[[TimeZone]]). 1. Let _result_ be a new empty List. 1. For each Record { [[Type]], [[Value]] } _patternPart_ in _patternParts_, do @@ -955,36 +1012,38 @@

    FormatDateTimePattern ( _dateTimeFormat_, _patternParts_, _x_, _rangeFormatO 1. If _p_ is *"literal"*, then 1. Append a new Record { [[Type]]: *"literal"*, [[Value]]: _patternPart_.[[Value]] } as the last element of the list _result_. 1. Else if _p_ is equal to *"fractionalSecondDigits"*, then + 1. Assert: _fractionalSecondDigits_ is not *undefined*. 1. Let _v_ be _tm_.[[Millisecond]]. - 1. Let _v_ be floor(_v_ × 10( _fractionalSecondDigits_ - 3 )). + 1. Set _v_ to floor(_v_ × 10( _fractionalSecondDigits_ - 3 )). 1. Let _fv_ be FormatNumeric(_nf3_, _v_). 1. Append a new Record { [[Type]]: *"fractionalSecond"*, [[Value]]: _fv_ } as the last element of _result_. 1. Else if _p_ is equal to *"dayPeriod"*, then - 1. Let _f_ be the value of _dateTimeFormat_'s internal slot whose name is the Internal Slot column of the matching row. + 1. Let _f_ be _dateTimeFormat_.[[DayPeriod]]. 1. Let _fv_ be a String value representing the day period of _tm_ in the form given by _f_; the String value depends upon the implementation and the effective locale of _dateTimeFormat_. 1. Append a new Record { [[Type]]: _p_, [[Value]]: _fv_ } as the last element of the list _result_. 1. Else if _p_ is equal to *"timeZoneName"*, then 1. Let _f_ be _dateTimeFormat_.[[TimeZoneName]]. 1. Let _v_ be _dateTimeFormat_.[[TimeZone]]. - 1. Let _fv_ be a String value representing _v_ in the form given by _f_; the String value depends upon the implementation and the effective locale of _dateTimeFormat_. The String value may also depend on the value of the [[InDST]] field of _tm_ if _f_ is *"short"*, *"long"*, *"shortOffset"*, or *"longOffset"*. If the implementation does not have a localized representation of _f_, then use the String value of _v_ itself. + 1. Let _fv_ be a String value representing _v_ in the form given by _f_; the String value depends upon the implementation and the effective locale of _dateTimeFormat_. The String value may also depend on the value of the [[InDST]] field of _tm_ if _f_ is *"short"*, *"long"*, *"shortOffset"*, or *"longOffset"*. If the implementation does not have such a localized representation of _v_, then use the String value of _v_ itself. 1. Append a new Record { [[Type]]: _p_, [[Value]]: _fv_ } as the last element of the list _result_. 1. Else if _p_ matches a Property column of the row in , then 1. If _rangeFormatOptions_ is not *undefined*, let _f_ be the value of _rangeFormatOptions_'s field whose name matches _p_. 1. Else, let _f_ be the value of _dateTimeFormat_'s internal slot whose name is the Internal Slot column of the matching row. 1. Let _v_ be the value of _tm_'s field whose name is the Internal Slot column of the matching row. - 1. If _p_ is *"year"* and _v_ ≤ 0, let _v_ be 1 - _v_. + 1. If _p_ is *"year"* and _v_ ≤ 0, set _v_ to 1 - _v_. 1. If _p_ is *"month"*, set _v_ to _v_ + 1. 1. If _p_ is *"hour"* and _dateTimeFormat_.[[HourCycle]] is *"h11"* or *"h12"*, then - 1. Let _v_ be _v_ modulo 12. - 1. If _v_ is 0 and _dateTimeFormat_.[[HourCycle]] is *"h12"*, let _v_ be 12. + 1. Set _v_ to _v_ modulo 12. + 1. If _v_ is 0 and _dateTimeFormat_.[[HourCycle]] is *"h12"*, set _v_ to 12. 1. If _p_ is *"hour"* and _dateTimeFormat_.[[HourCycle]] is *"h24"*, then - 1. If _v_ is 0, let _v_ be 24. + 1. If _v_ is 0, set _v_ to 24. 1. If _f_ is *"numeric"*, then 1. Let _fv_ be FormatNumeric(_nf_, _v_). 1. Else if _f_ is *"2-digit"*, then 1. Let _fv_ be FormatNumeric(_nf2_, _v_). - 1. If the *"length"* property of _fv_ is greater than 2, let _fv_ be the substring of _fv_ containing the last two characters. - 1. Else if _f_ is *"narrow"*, *"short"*, or *"long"*, then let _fv_ be a String value representing _v_ in the form given by _f_; the String value depends upon the implementation and the effective locale and calendar of _dateTimeFormat_. If _p_ is *"month"* and _rangeFormatOptions_ is *undefined*, then the String value may also depend on whether _dateTimeFormat_.[[Day]] is *undefined*. If _p_ is *"month"* and _rangeFormatOptions_ is not *undefined*, then the String value may also depend on whether _rangeFormatOptions_.[[day]] is *undefined*. If _p_ is *"era"* and _rangeFormatOptions_ is *undefined*, then the String value may also depend on whether _dateTimeFormat_.[[Era]] is *undefined*. If _p_ is *"era"* and _rangeFormatOptions_ is not *undefined*, then the String value may also depend on whether _rangeFormatOptions_.[[era]] is *undefined*. If the implementation does not have a localized representation of _f_, then use the String value of _v_ itself. + 1. If the *"length"* property of _fv_ is greater than 2, set _fv_ to the substring of _fv_ containing the last two characters. + 1. Else if _f_ is *"narrow"*, *"short"*, or *"long"*, then + 1. Let _fv_ be a String value representing _v_ in the form given by _f_; the String value depends upon the implementation and the effective locale and calendar of _dateTimeFormat_. If _p_ is *"month"* and _rangeFormatOptions_ is *undefined*, then the String value may also depend on whether _dateTimeFormat_.[[Day]] is *undefined*. If _p_ is *"month"* and _rangeFormatOptions_ is not *undefined*, then the String value may also depend on whether _rangeFormatOptions_.[[day]] is *undefined*. If _p_ is *"era"* and _rangeFormatOptions_ is *undefined*, then the String value may also depend on whether _dateTimeFormat_.[[Era]] is *undefined*. If _p_ is *"era"* and _rangeFormatOptions_ is not *undefined*, then the String value may also depend on whether _rangeFormatOptions_.[[era]] is *undefined*. If the implementation does not have such a localized representation of _v_, then use ! ToString(_v_). 1. Append a new Record { [[Type]]: _p_, [[Value]]: _fv_ } as the last element of the list _result_. 1. Else if _p_ is equal to *"ampm"*, then 1. Let _v_ be _tm_.[[Hour]]. @@ -1012,13 +1071,17 @@

    FormatDateTimePattern ( _dateTimeFormat_, _patternParts_, _x_, _rangeFormatO - -

    PartitionDateTimePattern ( _dateTimeFormat_, _x_ )

    - -

    - The PartitionDateTimePattern abstract operation is called with arguments _dateTimeFormat_ (which must be an object initialized as a DateTimeFormat) and _x_ (which must be a Number value), interprets _x_ as a time value as specified in es2024, , and creates the corresponding parts according to the effective locale and the formatting options of _dateTimeFormat_. The following steps are taken: -

    - + +

    + PartitionDateTimePattern ( + _dateTimeFormat_: an Intl.DateTimeFormat, + _x_: a Number, + ): either a normal completion containing a List of Records with fields [[Type]] (a String) and [[Value]] (a String), or a throw completion +

    +
    +
    description
    +
    It interprets _x_ as a time value as specified in es2024, , and creates the corresponding parts according to the effective locale and the formatting options of _dateTimeFormat_.
    +
    1. Let _patternParts_ be PartitionPattern(_dateTimeFormat_.[[Pattern]]). 1. Let _result_ be ? FormatDateTimePattern(_dateTimeFormat_, _patternParts_, _x_, *undefined*). @@ -1026,13 +1089,15 @@

    PartitionDateTimePattern ( _dateTimeFormat_, _x_ )

    - -

    FormatDateTime ( _dateTimeFormat_, _x_ )

    - -

    - The FormatDateTime abstract operation is called with arguments _dateTimeFormat_ (which must be an object initialized as a DateTimeFormat) and _x_ (which must be a Number value), and performs the following steps: -

    - + +

    + FormatDateTime ( + _dateTimeFormat_: an Intl.DateTimeFormat, + _x_: a Number, + ): either a normal completion containing a String or a throw completion +

    +
    +
    1. Let _parts_ be ? PartitionDateTimePattern(_dateTimeFormat_, _x_). 1. Let _result_ be the empty String. @@ -1042,13 +1107,15 @@

    FormatDateTime ( _dateTimeFormat_, _x_ )

    - -

    FormatDateTimeToParts ( _dateTimeFormat_, _x_ )

    - -

    - The FormatDateTimeToParts abstract operation is called with arguments _dateTimeFormat_ (which must be an object initialized as a DateTimeFormat) and _x_ (which must be a Number value), and performs the following steps: -

    - + +

    + FormatDateTimeToParts ( + _dateTimeFormat_: an Intl.DateTimeFormat, + _x_: a Number, + ): either a normal completion containing an Array or a throw completion +

    +
    +
    1. Let _parts_ be ? PartitionDateTimePattern(_dateTimeFormat_, _x_). 1. Let _result_ be ! ArrayCreate(0). @@ -1057,18 +1124,24 @@

    FormatDateTimeToParts ( _dateTimeFormat_, _x_ )

    1. Let _O_ be OrdinaryObjectCreate(%Object.prototype%). 1. Perform ! CreateDataPropertyOrThrow(_O_, *"type"*, _part_.[[Type]]). 1. Perform ! CreateDataPropertyOrThrow(_O_, *"value"*, _part_.[[Value]]). - 1. Perform ! CreateDataProperty(_result_, ! ToString(_n_), _O_). + 1. Perform ! CreateDataPropertyOrThrow(_result_, ! ToString(๐”ฝ(_n_)), _O_). 1. Increment _n_ by 1. 1. Return _result_.
    - -

    PartitionDateTimeRangePattern ( _dateTimeFormat_, _x_, _y_ )

    - -

    - The PartitionDateTimeRangePattern abstract operation is called with arguments _dateTimeFormat_ (which must be an object initialized as a DateTimeFormat), _x_ (which must be a Number value) and _y_ (which must be a Number value), interprets _x_ and _y_ as time values as specified in es2024, , and creates the corresponding parts according to the effective locale and the formatting options of _dateTimeFormat_. The following steps are taken: -

    + +

    + PartitionDateTimeRangePattern ( + _dateTimeFormat_: an Intl.DateTimeFormat, + _x_: a Number, + _y_: a Number, + ): either a normal completion containing a List of Records with fields [[Type]] (a String), [[Value]] (a String), and [[Source]] (a String), or a throw completion +

    +
    +
    description
    +
    It interprets _x_ and _y_ as time values as specified in es2024, , and creates the corresponding parts according to the effective locale and the formatting options of _dateTimeFormat_.
    +
    1. Set _x_ to TimeClip(_x_). 1. If _x_ is *NaN*, throw a *RangeError* exception. @@ -1110,7 +1183,7 @@

    PartitionDateTimeRangePattern ( _dateTimeFormat_, _x_, _y_ )

    1. Let _collapsedResult_ be a new empty List. 1. Let _pattern_ be _dateTimeFormat_.[[Pattern]]. 1. Let _patternParts_ be PartitionPattern(_pattern_). - 1. Let _resultParts_ be ? FormatDateTimePattern(_dateTimeFormat_, _patternParts_, _x_, *undefined*). + 1. Let _resultParts_ be ! FormatDateTimePattern(_dateTimeFormat_, _patternParts_, _x_, *undefined*). 1. For each Record { [[Type]], [[Value]] } _r_ in _resultParts_, do 1. Append a new Record { [[Type]]: _r_.[[Type]], [[Value]]: _r_.[[Value]], [[Source]]: *"shared"* } as the last element of _collapsedResult_. 1. Return _collapsedResult_. @@ -1125,20 +1198,23 @@

    PartitionDateTimeRangePattern ( _dateTimeFormat_, _x_, _y_ )

    1. Else, 1. Let _z_ be _y_. 1. Let _patternParts_ be PartitionPattern(_pattern_). - 1. Let _resultParts_ be ? FormatDateTimePattern(_dateTimeFormat_, _patternParts_, _z_, _selectedRangePattern_). + 1. Let _resultParts_ be ! FormatDateTimePattern(_dateTimeFormat_, _patternParts_, _z_, _selectedRangePattern_). 1. For each Record { [[Type]], [[Value]] } _r_ in _resultParts_, do 1. Append a new Record { [[Type]]: _r_.[[Type]], [[Value]]: _r_.[[Value]], [[Source]]: _source_ } as the last element of _rangeResult_. 1. Return _rangeResult_.
    - -

    FormatDateTimeRange ( _dateTimeFormat_, _x_, _y_ )

    - -

    - The FormatDateTimeRange abstract operation is called with arguments _dateTimeFormat_ (which must be an object initialized as a DateTimeFormat), _x_ (which must be a Number value) and _y_ (which must be a Number value), and performs the following steps: -

    - + +

    + FormatDateTimeRange ( + _dateTimeFormat_: an Intl.DateTimeFormat, + _x_: a Number, + _y_: a Number, + ): either a normal completion containing a String or a throw completion +

    +
    +
    1. Let _parts_ be ? PartitionDateTimeRangePattern(_dateTimeFormat_, _x_, _y_). 1. Let _result_ be the empty String. @@ -1148,13 +1224,16 @@

    FormatDateTimeRange ( _dateTimeFormat_, _x_, _y_ )

    - -

    FormatDateTimeRangeToParts ( _dateTimeFormat_, _x_, _y_ )

    - -

    - The FormatDateTimeRangeToParts abstract operation is called with arguments _dateTimeFormat_ (which must be an object initialized as a DateTimeFormat), _x_ (which must be a Number value) and _y_ (which must be a Number value), and performs the following steps: -

    - + +

    + FormatDateTimeRangeToParts ( + _dateTimeFormat_: an Intl.DateTimeFormat, + _x_: a Number, + _y_: a Number, + ): either a normal completion containing an Array or a throw completion +

    +
    +
    1. Let _parts_ be ? PartitionDateTimeRangePattern(_dateTimeFormat_, _x_, _y_). 1. Let _result_ be ! ArrayCreate(0). @@ -1164,7 +1243,7 @@

    FormatDateTimeRangeToParts ( _dateTimeFormat_, _x_, _y_ )

    1. Perform ! CreateDataPropertyOrThrow(_O_, *"type"*, _part_.[[Type]]). 1. Perform ! CreateDataPropertyOrThrow(_O_, *"value"*, _part_.[[Value]]). 1. Perform ! CreateDataPropertyOrThrow(_O_, *"source"*, _part_.[[Source]]). - 1. Perform ! CreateDataProperty(_result_, ! ToString(_n_), _O_). + 1. Perform ! CreateDataPropertyOrThrow(_result_, ! ToString(๐”ฝ(_n_)), _O_). 1. Increment _n_ by 1. 1. Return _result_.
    @@ -1176,7 +1255,7 @@

    _epochNs_: a BigInt, _calendar_: a String, _timeZoneIdentifier_: a String, - ) + ): a ToLocalTime Record

    @@ -1192,85 +1271,110 @@

    1. Let _offsetNs_ be GetNamedTimeZoneOffsetNanoseconds(_timeZoneIdentifier_, _epochNs_). 1. Let _tz_ be โ„(_epochNs_) + _offsetNs_. 1. If _calendar_ is *"gregory"*, then - 1. Return a record with fields calculated from _tz_ according to . + 1. Return a ToLocalTime Record with fields calculated from _tz_ according to . 1. Else, - 1. Return a record with the fields of Column 1 of calculated from _tz_ for the given _calendar_. The calculations should use best available information about the specified _calendar_. + 1. Return a ToLocalTime Record with the fields calculated from _tz_ for the given _calendar_. The calculations should use best available information about the specified _calendar_. + + A conforming implementation must recognize *"UTC"* and all Zone and Link names from the IANA Time Zone Database (and only such names), and use best available current and historical information about their offsets from UTC and their daylight saving time rules in calculations. + + + + +

    ToLocalTime Records

    + +

    + Each ToLocalTime Record has the fields defined in . +

    + Record returned by ToLocalTime + - + + + - + + + + - + + - + + - + + - + + - + + - + + +
    Field NameValue Type Value Calculation for Gregorian Calendar
    [[Weekday]]WeekDay(๐”ฝ(floor(_tz_ / 106)))an integerโ„(WeekDay(๐”ฝ(floor(_tz_ / 106))))
    [[Era]]a String Let _year_ be YearFromTime(๐”ฝ(floor(_tz_ / 106))). If _year_ < *1*๐”ฝ, return *"BC"*, else return *"AD"*.
    [[Year]]YearFromTime(๐”ฝ(floor(_tz_ / 106)))an integerโ„(YearFromTime(๐”ฝ(floor(_tz_ / 106))))
    [[RelatedYear]]an integer or *undefined* *undefined*
    [[YearName]]a String or *undefined* *undefined*
    [[Month]]MonthFromTime(๐”ฝ(floor(_tz_ / 106)))an integerโ„(MonthFromTime(๐”ฝ(floor(_tz_ / 106))))
    [[Day]]DateFromTime(๐”ฝ(floor(_tz_ / 106)))an integerโ„(DateFromTime(๐”ฝ(floor(_tz_ / 106))))
    [[Hour]]HourFromTime(๐”ฝ(floor(_tz_ / 106)))an integerโ„(HourFromTime(๐”ฝ(floor(_tz_ / 106))))
    [[Minute]]MinFromTime(๐”ฝ(floor(_tz_ / 106)))an integerโ„(MinFromTime(๐”ฝ(floor(_tz_ / 106))))
    [[Second]]SecFromTime(๐”ฝ(floor(_tz_ / 106)))an integerโ„(SecFromTime(๐”ฝ(floor(_tz_ / 106))))
    [[Millisecond]]msFromTime(๐”ฝ(floor(_tz_ / 106)))an integerโ„(msFromTime(๐”ฝ(floor(_tz_ / 106))))
    [[InDST]]a Boolean Calculate *true* or *false* using the best available information about the specified _calendar_ and _timeZoneIdentifier_, including current and historical information from the IANA Time Zone Database about time zone offsets from UTC and daylight saving time rules.
    - - - A conforming implementation must recognize *"UTC"* and all Zone and Link names from the IANA Time Zone Database (and only such names), and use best available current and historical information about their offsets from UTC and their daylight saving time rules in calculations. -
    - -

    UnwrapDateTimeFormat ( _dtf_ )

    -

    - The UnwrapDateTimeFormat abstract operation returns the DateTimeFormat instance - of its input object, which is either the value itself or a value associated - with it by %DateTimeFormat% according to the normative optional - constructor mode of . -

    + +

    + UnwrapDateTimeFormat ( + _dtf_: an ECMAScript language value, + ): either a normal completion containing an ECMAScript language value or a throw completion +

    +
    +
    description
    +
    + It returns the DateTimeFormat instance of its input object, which is either the value itself or a value associated with it by %DateTimeFormat% according to the normative optional constructor mode of . +
    +
    1. If Type(_dtf_) is not Object, throw a *TypeError* exception. 1. If _dtf_ does not have an [[InitializedDateTimeFormat]] internal slot and ? OrdinaryHasInstance(%DateTimeFormat%, _dtf_) is *true*, then diff --git a/spec/displaynames.html b/spec/displaynames.html index 44e528a8..2f647100 100644 --- a/spec/displaynames.html +++ b/spec/displaynames.html @@ -25,7 +25,7 @@

    Intl.DisplayNames ( _locales_, _options_ )

    1. Let _localeData_ be %DisplayNames%.[[LocaleData]]. 1. Let _matcher_ be ? GetOption(_options_, *"localeMatcher"*, ~string~, « *"lookup"*, *"best fit"* », *"best fit"*). 1. Set _opt_.[[localeMatcher]] to _matcher_. - 1. Let _r_ be ResolveLocale(%DisplayNames%.[[AvailableLocales]], _requestedLocales_, _opt_, %DisplayNames%.[[RelevantExtensionKeys]]). + 1. Let _r_ be ResolveLocale(%DisplayNames%.[[AvailableLocales]], _requestedLocales_, _opt_, %DisplayNames%.[[RelevantExtensionKeys]], _localeData_). 1. Let _style_ be ? GetOption(_options_, *"style"*, ~string~, « *"narrow"*, *"short"*, *"long"* », *"long"*). 1. Set _displayNames_.[[Style]] to _style_. 1. Let _type_ be ? GetOption(_options_, *"type"*, ~string~, « *"language"*, *"region"*, *"script"*, *"currency"*, *"calendar"*, *"dateTimeField"* », *undefined*). @@ -43,7 +43,7 @@

    Intl.DisplayNames ( _locales_, _options_ )

    1. Assert: _typeFields_ is a Record (see ). 1. If _type_ is *"language"*, then 1. Set _displayNames_.[[LanguageDisplay]] to _languageDisplay_. - 1. Let _typeFields_ be _typeFields_.[[<_languageDisplay_>]]. + 1. Set _typeFields_ to _typeFields_.[[<_languageDisplay_>]]. 1. Assert: _typeFields_ is a Record (see ). 1. Let _styleFields_ be _typeFields_.[[<_style_>]]. 1. Assert: _styleFields_ is a Record (see ). @@ -145,7 +145,7 @@

    Intl.DisplayNames.prototype[ @@toStringTag ]

    - +

    Intl.DisplayNames.prototype.of ( _code_ )

    @@ -156,7 +156,7 @@

    Intl.DisplayNames.prototype.of ( _code_ )

    1. Let _displayNames_ be *this* value. 1. Perform ? RequireInternalSlot(_displayNames_, [[InitializedDisplayNames]]). 1. Let _code_ be ? ToString(_code_). - 1. Let _code_ be ? CanonicalCodeForDisplayNames(_displayNames_.[[Type]], _code_). + 1. Set _code_ to ? CanonicalCodeForDisplayNames(_displayNames_.[[Type]], _code_). 1. Let _fields_ be _displayNames_.[[Fields]]. 1. If _fields_ has a field [[<_code_>]], return _fields_.[[<_code_>]]. 1. If _displayNames_.[[Fallback]] is *"code"*, return _code_. @@ -278,7 +278,7 @@

    1. If the result of IsValidDateTimeFieldCode(_code_) is *false*, throw a *RangeError* exception. 1. Return _code_. 1. Assert: _type_ is *"currency"*. - 1. If ! IsWellFormedCurrencyCode(_code_) is *false*, throw a *RangeError* exception. + 1. If IsWellFormedCurrencyCode(_code_) is *false*, throw a *RangeError* exception. 1. Return the ASCII-uppercase of _code_. @@ -287,7 +287,7 @@

    IsValidDateTimeFieldCode ( _field_: a String, - ) + ): a Boolean

    description
    diff --git a/spec/index.html b/spec/index.html index 6588d4d1..23f17bbf 100644 --- a/spec/index.html +++ b/spec/index.html @@ -2,9 +2,7 @@ - -