@@ -360,6 +360,27 @@ <h1>ToLocalTime ( _date_, _calendar_, _timeZone_ )</h1>
360
360
It is recommended that implementations use the time zone information of the IANA Time Zone Database.
361
361
</emu-note >
362
362
</emu-clause >
363
+
364
+ <emu-clause id =" sec-unwrapdatetimeformat" aoid =" UnwrapDateTimeFormat" >
365
+ <h1 >UnwrapDateTimeFormat( dtf )</h1 >
366
+ <p >
367
+ The UnwrapDateTimeFormat abstract operation gets the underlying DateTimeFormat operation
368
+ for various methods which implement ECMA-402 v1 semantics for supporting initializing
369
+ existing Intl objects.
370
+ </p >
371
+ <emu-normative-optional ><span class =" normative-optional" >Normative Optional</span ><div class =" normative-optional-contents" >
372
+ <emu-alg >
373
+ 1. If _dtf_ does not have an [[initializedDateTimeFormat]] internal slot and ? InstanceofOperator(_dtf_ , %DateTimeFormat%),
374
+ 1. Let _dtf_ be ? RequireObjectCoercible(Get(_dtf_ , Intl.[[FallbackSymbol]])).
375
+ </emu-alg >
376
+ </div ></emu-normative-optional >
377
+ <emu-alg >
378
+ 2. If _dtf_ does not have an [[initializedDateTimeFormat]] internal slot,
379
+ 1. Throw a *TypeError* exception.
380
+ 1. Return _dtf_ .
381
+ </emu-alg >
382
+ </emu-clause >
383
+ </emu-clause >
363
384
</emu-clause >
364
385
365
386
<emu-clause id =" sec-intl-datetimeformat-constructor" >
@@ -379,7 +400,18 @@ <h1>Intl.DateTimeFormat ( [ _locales_ [ , _options_ ] ] )</h1>
379
400
<emu-alg >
380
401
1. If NewTarget is *undefined* , let _newTarget_ be the active function object, else let _newTarget_ be NewTarget.
381
402
1. Let _dateTimeFormat_ be ? OrdinaryCreateFromConstructor(_newTarget_ , `"%DateTimeFormatPrototype%"` , « ; [[initializedIntlObject]], [[initializedDateTimeFormat]], [[locale]], [[calendar]], [[numberingSystem]], [[timeZone]], [[weekday]], [[era]], [[year]], [[month]], [[day]], [[hour]], [[minute]], [[second]], [[timeZoneName]], [[hour12]], [[hourNo0]], [[pattern]], [[boundFormat]] » ; ).
382
- 1. Return ? InitializeDateTimeFormat(_dateTimeFormat_ , _locales_ , _options_ ).
403
+ 1. Perform ? InitializeDateTimeFormat(_dateTimeFormat_ , _locales_ , _options_ ).
404
+ </emu-alg >
405
+ <emu-normative-optional ><span class =" normative-optional" >Normative Optional</span ><div class =" normative-optional-contents" >
406
+ <emu-alg >
407
+ 4. Let _this_ be the *this* value.
408
+ 1. If NewTarget is *undefined* and ? InstanceofOperator(_this_ , %NumberFormat%),
409
+ 1. Perform ? DefineOwnPropertyOrThrow(_this_ , Intl.[[FallbackSymbol]], { [[Value]]: _dateTimeFormat_ , [[Writable]]: *false* , [[Enumerable]]: *false* , [[Configurable]]: *false* }).
410
+ 1. Return _this_ .
411
+ </emu-alg >
412
+ </div ></emu-normative-optional >
413
+ <emu-alg >
414
+ 1. Return _dateTimeFormat_ .
383
415
</emu-alg >
384
416
</emu-clause >
385
417
</emu-clause >
@@ -512,7 +544,7 @@ <h1>get Intl.DateTimeFormat.prototype.format</h1>
512
544
<emu-alg >
513
545
1. Let _dtf_ be *this* value.
514
546
1. If Type(_dtf_ ) is not Object, throw a *TypeError* exception.
515
- 1. If _dtf_ does not have an [[initializedDateTimeFormat]] internal slot, throw a *TypeError* exception .
547
+ 1. Let _dtf_ be ? UnwrapDateTimeFormat( _dtf_ ) .
516
548
1. If _dtf_ .[[boundFormat]] is *undefined* , then
517
549
1. Let _F_ be a new built-in function object as defined in DateTime Format Functions (<emu-xref href =" #sec-datetime-format-functions" ></emu-xref >).
518
550
1. Let _bf_ be BoundFunctionCreate(_F_ , _dft_ , « ; » ; ).
@@ -545,7 +577,7 @@ <h1>Intl.DateTimeFormat.prototype.formatToParts ( [ _date_ ] )</h1>
545
577
<h1 >Intl.DateTimeFormat.prototype.resolvedOptions ()</h1 >
546
578
547
579
<p >
548
- This function provides access to the locale and formatting options computed during initialization of the object.
580
+ This function provides access to the locale and formatting options computed during initialization of the object. This function initially invokes the internal algorithm UnwrapDateTimeFormat to get the %DateTimeFormat% object on which to operate.
549
581
</p >
550
582
551
583
<p >
0 commit comments