@@ -160,12 +160,34 @@ <h1>InitializeDateTimeFormat ( _dateTimeFormat_, _locales_, _options_ )</h1>
160
160
1. Let _value_ be ? GetOption(_options_ , _prop_ , *"string"* , « the strings given in the Values column of the row », *undefined* ).
161
161
1. Set _opt_ .[[< ; _prop_ > ; ]] to _value_ .
162
162
1. <del >Let _dataLocaleData_ be _localeData_ .[[< ; _dataLocale_ > ; ]].</del >
163
- 1. Let _formats_ be _dataLocaleData_ .[[formats]].[[< ; _calendar_ > ; ]].
164
163
1. Let _matcher_ be ? GetOption(_options_ , *"formatMatcher"* , *"string"* , « *"basic"* , *"best fit"* », *"best fit"* ).
165
- 1. <del >If _matcher_ is *"basic"* , then</del >
166
- 1. <del >Let _bestFormat_ be BasicFormatMatcher(_opt_ , _formats_ ).</del >
167
- 1. <del >Else,</del >
168
- 1. <del >Let _bestFormat_ be BestFitFormatMatcher(_opt_ , _formats_ ).</del >
164
+ 1. Let _dateStyle_ be ? GetOption(_options_ , *"dateStyle"* , *"string"* , « *"full"* , *"long"* , *"medium"* , *"short"* », *undefined* ).
165
+ 1. Set _dateTimeFormat_ .[[DateStyle]] to _dateStyle_ .
166
+ 1. Let _timeStyle_ be ? GetOption(_options_ , *"timeStyle"* , *"string"* , « *"full"* , *"long"* , *"medium"* , *"short"* », *undefined* ).
167
+ 1. Set _dateTimeFormat_ .[[TimeStyle]] to _timeStyle_ .
168
+ 1. If _dateStyle_ is not *undefined* or _timeStyle_ is not *undefined* , then
169
+ 1. For each row in <emu-xref href =" #table-datetimeformat-components" ></emu-xref >, except the header row, do
170
+ 1. Let _prop_ be the name given in the Property column of the row.
171
+ 1. Let _p_ be _opt_ .[[< ; _prop_ > ; ]].
172
+ 1. If _p_ is not *undefined* , then
173
+ 1. Throw a *TypeError* exception.
174
+ 1. Let _bestFormat_ be DateTimeStyleFormat(_dateStyle_ , _timeStyle_ , _dataLocaleData_ ).
175
+ 1. <mark >TODO: figure out how to deal with Temporal objects here.</mark >
176
+ 1. Else,
177
+ 1. Let _formats_ be _dataLocaleData_ .[[formats]].[[< ; _calendar_ > ; ]].
178
+ 1. <del >If _matcher_ is *"basic"* , then</del >
179
+ 1. <del >Let _bestFormat_ be BasicFormatMatcher(_opt_ , _formats_ ).</del >
180
+ 1. <del >Else,</del >
181
+ 1. <del >Let _bestFormat_ be BestFitFormatMatcher(_opt_ , _formats_ ).</del >
182
+ 1. <ins >Let _expandedOptions_ be a copy of _opt_ .</ins >
183
+ 1. <ins >Let _needDefaults_ be *true* .</ins >
184
+ 1. <ins >For each element _field_ of « *"weekday"* , *"year"* , *"month"* , *"day"* , *"hour"* , *"minute"* , *"second"* » in List order, do</ins >
185
+ 1. <ins >If _expandedOptions_ .[[< ; _field_ > ; ]] is not *undefined* , then</ins >
186
+ 1. <ins >Set _needDefaults_ to *false* .</ins >
187
+ 1. <ins >If _needDefaults_ is *true* , then</ins >
188
+ 1. <ins >For each element _field_ of « *"year"* , *"month"* , *"day"* , *"hour"* , *"minute"* , *"second"* » in List order, do</ins >
189
+ 1. <ins >Set _expandedOptions_ .[[< ; _field_ > ; ]] to *"numeric"* .</ins >
190
+ 1. <ins >Let _bestFormat_ be GetDateTimeFormatPattern(_matcher_ , _expandedOptions_ , _formats_ , _hc_ ).</ins >
169
191
1. <del >For each row in <emu-xref href =" #table-datetimeformat-components" ></emu-xref >, except the header row, in table order, do</del >
170
192
1. <del >Let _prop_ be the name given in the Property column of the row.</del >
171
193
1. <del >Let _p_ be _bestFormat_ .[[< ; _prop_ > ; ]].</del >
@@ -196,18 +218,7 @@ <h1>InitializeDateTimeFormat ( _dateTimeFormat_, _locales_, _options_ )</h1>
196
218
1. <del >Let _pattern_ be _bestFormat_ .[[pattern12]].</del >
197
219
1. <del >Else,</del >
198
220
1. <del >Let _pattern_ be _bestFormat_ .[[pattern]].</del >
199
- 1. <del >Else,</del >
200
- 1. <del >Set _dateTimeFormat_ .[[HourCycle]] to *undefined* .</del >
201
- 1. <del >Let _pattern_ be _bestFormat_ .[[pattern]].</del >
202
- 1. <ins >Let _expandedOptions_ be a copy of _opt_ .</ins >
203
- 1. <ins >Let _needDefaults_ be *true* .</ins >
204
- 1. <ins >For each element _field_ of « *"weekday"* , *"year"* , *"month"* , *"day"* , *"hour"* , *"minute"* , *"second"* » in List order, do</ins >
205
- 1. <ins >If _expandedOptions_ .[[< ; _field_ > ; ]] is not *undefined* , then</ins >
206
- 1. <ins >Set _needDefaults_ to *false* .</ins >
207
- 1. <ins >If _needDefaults_ is *true* , then</ins >
208
- 1. <ins >For each element _field_ of « *"year"* , *"month"* , *"day"* , *"hour"* , *"minute"* , *"second"* » in List order, do</ins >
209
- 1. <ins >Set _expandedOptions_ .[[< ; _field_ > ; ]] to *"numeric"* .</ins >
210
- 1. Set _dateTimeFormat_ .[[Pattern]] to <del >_pattern_ </del ><ins >GetDateTimeFormatPattern(_matcher_ , _expandedOptions_ , _formats_ , _hc_ )</ins >.
221
+ 1. Set _dateTimeFormat_ .[[Pattern]] to <del >_pattern_ </del ><ins >_bestFormat_ .[[pattern]]</ins >.
211
222
1. <ins >For each row in <emu-xref href =" #table-temporal-patterns" ></emu-xref >, except the header row, in table order, do</ins >
212
223
1. <ins >Let _limitedOptions_ be a new Record.</ins >
213
224
1. <ins >Let _needDefaults_ be *true* .</ins >
@@ -699,6 +710,9 @@ <h1>Intl.DateTimeFormat.prototype.resolvedOptions ( )</h1>
699
710
1. <ins >Else,</ins >
700
711
1. <ins >Assert: the Location value of the current row is ~pattern~ .</ins >
701
712
1. <ins >Let _v_ be the value of _dtf_ .[[Pattern]]'s internal slot whose name is the Internal Slot value of the current row.</ins >
713
+ 1. If the Internal Slot value of the current row is an Internal Slot value in <emu-xref href =" #table-datetimeformat-components" ></emu-xref >, then
714
+ 1. If _dtf_ .[[DateStyle]] is not *undefined* or _dtf_ .[[TimeStyle]] is not *undefined* , then
715
+ 1. Let _v_ be *undefined* .
702
716
1. If _v_ is not *undefined* , then
703
717
1. Perform ! CreateDataPropertyOrThrow(_options_ , _p_ , _v_ ).
704
718
1. Return _options_ .
@@ -793,6 +807,16 @@ <h1>Intl.DateTimeFormat.prototype.resolvedOptions ( )</h1>
793
807
<td ><del >[[TimeZoneName]]</del ><ins >[[timeZoneName]]</ins ></td >
794
808
<td >*"timeZoneName"* </td >
795
809
<td ><ins >~pattern~ </ins ></td >
810
+ <tr >
811
+ <td >[[DateStyle]]</td >
812
+ <td >*"dateStyle"* </td >
813
+ <td ><ins >~object~ </ins ></td >
814
+ </tr >
815
+ <tr >
816
+ <td >[[TimeStyle]]</td >
817
+ <td >*"timeStyle"* </td >
818
+ <td ><ins >~object~ </ins ></td >
819
+ </tr >
796
820
</tr >
797
821
</table >
798
822
</emu-table >
@@ -834,6 +858,7 @@ <h1><a href="https://tc39.es/ecma402/#sec-properties-of-intl-datetimeformat-inst
834
858
<li ><del >[[Weekday]], [[Era]], [[Year]], [[Month]], [[Day]], [[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 <emu-xref href =" #table-datetimeformat-components" ></emu-xref >, indicating how the component should be presented in the formatted output.</del ></li >
835
859
<li ><del >[[FractionalSecondDigits]] is either *undefined* or a positive, non-negative integer Number value indicating the fraction digits to be used for fractional seconds. Numbers will be rounded or padded with trailing zeroes if necessary.</del ></li >
836
860
<li ><del >[[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* .</del ></li >
861
+ <li >[[DateStyle]], [[TimeStyle]] are each either *undefined* , or a String value with values *"full"* , *"long"* , *"medium"* , or *"short"* .</li >
837
862
<li >[[Pattern]]<ins >, [[TemporalPlainDatePattern]], [[TemporalPlainYearMonthPattern]], [[TemporalPlainMonthDayPattern]], [[TemporalPlainTimePattern]], [[TemporalPlainDateTimePattern]], [[TemporalInstantPattern]], and [[TemporalZonedDateTimePattern]] are</ins > <del >is a String value</del ><ins >records containing at least a [[pattern]] field</ins > as described in <emu-xref href =" #sec-intl.datetimeformat-internal-slots" ></emu-xref >.</li >
838
863
</ul >
839
864
0 commit comments