Skip to content

Commit

Permalink
ECMA-402 v1 constructor compatibility semantics for DateTimeFormat
Browse files Browse the repository at this point in the history
  • Loading branch information
littledan committed Dec 28, 2016
1 parent b97fabb commit 8775fdc
Showing 1 changed file with 35 additions and 3 deletions.
38 changes: 35 additions & 3 deletions spec/datetimeformat.html
Original file line number Diff line number Diff line change
Expand Up @@ -360,6 +360,27 @@ <h1>ToLocalTime ( _date_, _calendar_, _timeZone_ )</h1>
It is recommended that implementations use the time zone information of the IANA Time Zone Database.
</emu-note>
</emu-clause>

<emu-clause id="sec-unwrapdatetimeformat" aoid="UnwrapDateTimeFormat">
<h1>UnwrapDateTimeFormat( dtf )</h1>
<p>
The UnwrapDateTimeFormat abstract operation gets the underlying DateTimeFormat operation
for various methods which implement ECMA-402 v1 semantics for supporting initializing
existing Intl objects.
</p>
<emu-normative-optional><span class="normative-optional">Normative Optional</span><div class="normative-optional-contents">
<emu-alg>
1. If _dtf_ does not have an [[initializedDateTimeFormat]] internal slot and ? InstanceofOperator(_dtf_, %DateTimeFormat%),
1. Let _dtf_ be ? RequireObjectCoercible(Get(_dtf_, Intl.[[FallbackSymbol]])).
</emu-alg>
</div></emu-normative-optional>
<emu-alg>
2. If _dtf_ does not have an [[initializedDateTimeFormat]] internal slot,
1. Throw a *TypeError* exception.
1. Return _dtf_.
</emu-alg>
</emu-clause>
</emu-clause>
</emu-clause>

<emu-clause id="sec-intl-datetimeformat-constructor">
Expand All @@ -379,7 +400,18 @@ <h1>Intl.DateTimeFormat ( [ _locales_ [ , _options_ ] ] )</h1>
<emu-alg>
1. If NewTarget is *undefined*, let _newTarget_ be the active function object, else let _newTarget_ be NewTarget.
1. Let _dateTimeFormat_ be ? OrdinaryCreateFromConstructor(_newTarget_, `"%DateTimeFormatPrototype%"`, &laquo; [[initializedIntlObject]], [[initializedDateTimeFormat]], [[locale]], [[calendar]], [[numberingSystem]], [[timeZone]], [[weekday]], [[era]], [[year]], [[month]], [[day]], [[hour]], [[minute]], [[second]], [[timeZoneName]], [[hour12]], [[hourNo0]], [[pattern]], [[boundFormat]] &raquo;).
1. Return ? InitializeDateTimeFormat(_dateTimeFormat_, _locales_, _options_).
1. Perform ? InitializeDateTimeFormat(_dateTimeFormat_, _locales_, _options_).
</emu-alg>
<emu-normative-optional><span class="normative-optional">Normative Optional</span><div class="normative-optional-contents">
<emu-alg>
4. Let _this_ be the *this* value.
1. If NewTarget is *undefined* and ? InstanceofOperator(_this_, %NumberFormat%),
1. Perform ? DefineOwnPropertyOrThrow(_this_, Intl.[[FallbackSymbol]], { [[Value]]: _dateTimeFormat_, [[Writable]]: *false*, [[Enumerable]]: *false*, [[Configurable]]: *false* }).
1. Return _this_.
</emu-alg>
</div></emu-normative-optional>
<emu-alg>
1. Return _dateTimeFormat_.
</emu-alg>
</emu-clause>
</emu-clause>
Expand Down Expand Up @@ -512,7 +544,7 @@ <h1>get Intl.DateTimeFormat.prototype.format</h1>
<emu-alg>
1. Let _dtf_ be *this* value.
1. If Type(_dtf_) is not Object, throw a *TypeError* exception.
1. If _dtf_ does not have an [[initializedDateTimeFormat]] internal slot, throw a *TypeError* exception.
1. Let _dtf_ be ? UnwrapDateTimeFormat(_dtf_).
1. If _dtf_.[[boundFormat]] is *undefined*, then
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>).
1. Let _bf_ be BoundFunctionCreate(_F_, _dft_, &laquo; &raquo;).
Expand Down Expand Up @@ -545,7 +577,7 @@ <h1>Intl.DateTimeFormat.prototype.formatToParts ( [ _date_ ] )</h1>
<h1>Intl.DateTimeFormat.prototype.resolvedOptions ()</h1>

<p>
This function provides access to the locale and formatting options computed during initialization of the object.
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.
</p>

<p>
Expand Down

0 comments on commit 8775fdc

Please sign in to comment.