Skip to content

Commit a1f6ff3

Browse files
committed
Editorial: Update InitializeDateTimeFormat to use more standard conventions
1 parent 6804096 commit a1f6ff3

File tree

1 file changed

+10
-11
lines changed

1 file changed

+10
-11
lines changed

spec/datetimeformat.html

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ <h1>InitializeDateTimeFormat ( _dateTimeFormat_, _locales_, _options_ )</h1>
5151

5252
<emu-alg>
5353
1. Let _requestedLocales_ be ? CanonicalizeLocaleList(_locales_).
54-
1. Let _options_ be ? ToDateTimeOptions(_options_, *"any"*, *"date"*).
54+
1. Set _options_ to ? ToDateTimeOptions(_options_, *"any"*, *"date"*).
5555
1. Let _opt_ be a new Record.
5656
1. Let _matcher_ be ? GetOption(_options_, *"localeMatcher"*, *"string"*, &laquo; *"lookup"*, *"best fit"* &raquo;, *"best fit"*).
5757
1. Set _opt_.[[localeMatcher]] to _matcher_.
@@ -66,32 +66,32 @@ <h1>InitializeDateTimeFormat ( _dateTimeFormat_, _locales_, _options_ )</h1>
6666
1. Let _hour12_ be ? GetOption(_options_, *"hour12"*, *"boolean"*, *undefined*, *undefined*).
6767
1. Let _hourCycle_ be ? GetOption(_options_, *"hourCycle"*, *"string"*, &laquo; *"h11"*, *"h12"*, *"h23"*, *"h24"* &raquo;, *undefined*).
6868
1. If _hour12_ is not *undefined*, then
69-
1. Let _hourCycle_ be *null*.
69+
1. Set _hourCycle_ to *null*.
7070
1. Set _opt_.[[hc]] to _hourCycle_.
7171
1. Let _localeData_ be %DateTimeFormat%.[[LocaleData]].
7272
1. Let _r_ be ResolveLocale(%DateTimeFormat%.[[AvailableLocales]], _requestedLocales_, _opt_, %DateTimeFormat%.[[RelevantExtensionKeys]], _localeData_).
7373
1. Set _dateTimeFormat_.[[Locale]] to _r_.[[locale]].
74-
1. Let _calendar_ be _r_.[[ca]].
74+
1. Set _calendar_ to _r_.[[ca]].
7575
1. Set _dateTimeFormat_.[[Calendar]] to _calendar_.
7676
1. Set _dateTimeFormat_.[[HourCycle]] to _r_.[[hc]].
7777
1. Set _dateTimeFormat_.[[NumberingSystem]] to _r_.[[nu]].
7878
1. Let _dataLocale_ be _r_.[[dataLocale]].
7979
1. Let _timeZone_ be ? Get(_options_, *"timeZone"*).
8080
1. If _timeZone_ is *undefined*, then
81-
1. Let _timeZone_ be DefaultTimeZone().
81+
1. Set _timeZone_ to ! DefaultTimeZone().
8282
1. Else,
83-
1. Let _timeZone_ be ? ToString(_timeZone_).
84-
1. If the result of IsValidTimeZoneName(_timeZone_) is *false*, then
85-
1. Throw a *RangeError* exception.
86-
1. Let _timeZone_ be CanonicalizeTimeZoneName(_timeZone_).
83+
1. Set _timeZone_ to ? ToString(_timeZone_).
84+
1. If ! IsValidTimeZoneName(_timeZone_) is *false*, throw a *RangeError* exception.
85+
1. Set _timeZone_ to ! CanonicalizeTimeZoneName(_timeZone_).
8786
1. Set _dateTimeFormat_.[[TimeZone]] to _timeZone_.
8887
1. Let _formatOptions_ be a new Record.
8988
1. For each row of <emu-xref href="#table-datetimeformat-components"></emu-xref>, except the header row, in table order, do
9089
1. Let _prop_ be the name given in the Property column of the row.
9190
1. If _prop_ is *"fractionalSecondDigits"*, then
9291
1. Let _value_ be ? GetNumberOption(_options_, *"fractionalSecondDigits"*, 1, 3, *undefined*).
9392
1. Else,
94-
1. Let _value_ be ? GetOption(_options_, _prop_, *"string"*, &laquo; the strings given in the Values column of the row &raquo;, *undefined*).
93+
1. Let _values_ be a List whose elements are the strings given in the Values column of the row.
94+
1. Let _value_ be ? GetOption(_options_, _prop_, *"string"*, _values_, *undefined*).
9595
1. Set _formatOptions_.[[&lt;_prop_&gt;]] to _value_.
9696
1. Let _dataLocaleData_ be _localeData_.[[&lt;_dataLocale_&gt;]].
9797
1. Let _hcDefault_ be _dataLocaleData_.[[hourCycle]].
@@ -120,8 +120,7 @@ <h1>InitializeDateTimeFormat ( _dateTimeFormat_, _locales_, _options_ )</h1>
120120
1. If _dateStyle_ is not *undefined* or _timeStyle_ is not *undefined*, then
121121
1. For each row in <emu-xref href="#table-datetimeformat-components"></emu-xref>, except the header row, do
122122
1. Let _prop_ be the name given in the Property column of the row.
123-
1. Let _p_ be _formatOptions_.[[&lt;_prop_&gt;]].
124-
1. If _p_ is not *undefined*, then
123+
1. If _formatOptions_.[[&lt;_prop_&gt;]] is present and its value is not *undefined*, then
125124
1. Throw a *TypeError* exception.
126125
1. Let _styles_ be _dataLocaleData_.[[styles]].[[&lt;_calendar_&gt;]].
127126
1. Let _bestFormat_ be DateTimeStyleFormat(_dateStyle_, _timeStyle_, _styles_).

0 commit comments

Comments
 (0)