Skip to content

Commit 0836725

Browse files
committed
Editorial: Simplify {date,time}Style vs. explicit component checking
1 parent a1f6ff3 commit 0836725

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

spec/datetimeformat.html

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ <h1>InitializeDateTimeFormat ( _dateTimeFormat_, _locales_, _options_ )</h1>
8585
1. Set _timeZone_ to ! CanonicalizeTimeZoneName(_timeZone_).
8686
1. Set _dateTimeFormat_.[[TimeZone]] to _timeZone_.
8787
1. Let _formatOptions_ be a new Record.
88+
1. Let _hasExplicitFormatComponents_ be *false*.
8889
1. For each row of <emu-xref href="#table-datetimeformat-components"></emu-xref>, except the header row, in table order, do
8990
1. Let _prop_ be the name given in the Property column of the row.
9091
1. If _prop_ is *"fractionalSecondDigits"*, then
@@ -93,6 +94,7 @@ <h1>InitializeDateTimeFormat ( _dateTimeFormat_, _locales_, _options_ )</h1>
9394
1. Let _values_ be a List whose elements are the strings given in the Values column of the row.
9495
1. Let _value_ be ? GetOption(_options_, _prop_, *"string"*, _values_, *undefined*).
9596
1. Set _formatOptions_.[[&lt;_prop_&gt;]] to _value_.
97+
1. If _value_ is not *undefined*, set _hasExplicitFormatComponents_ to *true*.
9698
1. Let _dataLocaleData_ be _localeData_.[[&lt;_dataLocale_&gt;]].
9799
1. Let _hcDefault_ be _dataLocaleData_.[[hourCycle]].
98100
1. Let _hc_ be _dateTimeFormat_.[[HourCycle]].
@@ -118,10 +120,7 @@ <h1>InitializeDateTimeFormat ( _dateTimeFormat_, _locales_, _options_ )</h1>
118120
1. Let _timeStyle_ be ? GetOption(_options_, *"timeStyle"*, *"string"*, &laquo; *"full"*, *"long"*, *"medium"*, *"short"* &raquo;, *undefined*).
119121
1. Set _dateTimeFormat_.[[TimeStyle]] to _timeStyle_.
120122
1. If _dateStyle_ is not *undefined* or _timeStyle_ is not *undefined*, then
121-
1. For each row in <emu-xref href="#table-datetimeformat-components"></emu-xref>, except the header row, do
122-
1. Let _prop_ be the name given in the Property column of the row.
123-
1. If _formatOptions_.[[&lt;_prop_&gt;]] is present and its value is not *undefined*, then
124-
1. Throw a *TypeError* exception.
123+
1. If _hasExplicitFormatComponents_ is *true*, throw a *TypeError* exception.
125124
1. Let _styles_ be _dataLocaleData_.[[styles]].[[&lt;_calendar_&gt;]].
126125
1. Let _bestFormat_ be DateTimeStyleFormat(_dateStyle_, _timeStyle_, _styles_).
127126
1. Else,

0 commit comments

Comments
 (0)