Skip to content

Commit 5109a7a

Browse files
committed
Editorial: Issue a warning when falling back from islamic or islamic-rgsa
ECMA-262 has language similar to this to encourage the implementation to log a warning. See #49
1 parent 6c18261 commit 5109a7a

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4139,7 +4139,7 @@ <h1><span class="secnum">3.1.1</span> CreateDateTimeFormat ( <var>newTarget</var
41394139
41404140
<p>The abstract operation CreateDateTimeFormat takes arguments <var>newTarget</var> (a <emu-xref href="#constructor"><a href="https://tc39.es/ecma262/#constructor">constructor</a></emu-xref>), <var>locales</var> (an <emu-xref href="#sec-ecmascript-language-types"><a href="https://tc39.es/ecma262/#sec-ecmascript-language-types">ECMAScript language value</a></emu-xref>), <var>options</var> (an <emu-xref href="#sec-ecmascript-language-types"><a href="https://tc39.es/ecma262/#sec-ecmascript-language-types">ECMAScript language value</a></emu-xref>), <var>required</var> (<emu-const>date</emu-const>, <emu-const>time</emu-const>, or <emu-const>any</emu-const>), and <var>defaults</var> (<emu-const>date</emu-const>, <emu-const>time</emu-const>, or <emu-const>all</emu-const>) and returns either a <emu-xref href="#sec-completion-record-specification-type"><a href="https://tc39.es/ecma262/#sec-completion-record-specification-type">normal completion containing</a></emu-xref> a DateTimeFormat object or a <emu-xref href="#sec-completion-record-specification-type"><a href="https://tc39.es/ecma262/#sec-completion-record-specification-type">throw completion</a></emu-xref>. It performs the following steps when called:</p>
41414141
4142-
<emu-alg><ol><li>Let <var>dateTimeFormat</var> be ?&nbsp;<emu-xref aoid="OrdinaryCreateFromConstructor"><a href="https://tc39.es/ecma262/#sec-ordinarycreatefromconstructor">OrdinaryCreateFromConstructor</a></emu-xref>(<var>newTarget</var>, <emu-val>"%Intl.DateTimeFormat.prototype%"</emu-val>, « <var class="field">[[InitializedDateTimeFormat]]</var>, <var class="field">[[Locale]]</var>, <var class="field">[[Calendar]]</var>, <var class="field">[[NumberingSystem]]</var>, <var class="field">[[TimeZone]]</var>, <var class="field">[[HourCycle]]</var>, <var class="field">[[DateStyle]]</var>, <var class="field">[[TimeStyle]]</var>, <var class="field">[[DateTimeFormat]]</var>, <var class="field">[[BoundFormat]]</var>&nbsp;»).</li><li>Let <var>hour12</var> be <emu-val>undefined</emu-val>.</li><li>Let <var>modifyResolutionOptions</var> be a new <emu-xref href="#sec-abstract-closure"><a href="https://tc39.es/ecma262/#sec-abstract-closure">Abstract Closure</a></emu-xref> with parameters (<var>options</var>) that captures <var>hour12</var> and performs the following steps when called:<ol><li>Set <var>hour12</var> to <var>options</var>.<var class="field">[[hour12]]</var>.</li><li>Remove field <var class="field">[[hour12]]</var> from <var>options</var>.</li><li>If <var>hour12</var> is not <emu-val>undefined</emu-val>, set <var>options</var>.<var class="field">[[hc]]</var> to <emu-val>null</emu-val>.</li></ol></li><li>Let <var>optionsResolution</var> be ?&nbsp;<emu-xref aoid="ResolveOptions"><a href="https://tc39.es/ecma402/#sec-resolveoptions">ResolveOptions</a></emu-xref>(<emu-xref href="#sec-intl-datetimeformat-constructor"><a href="https://tc39.es/ecma402/#sec-intl-datetimeformat-constructor">%Intl.DateTimeFormat%</a></emu-xref>, <emu-xref href="#sec-intl-datetimeformat-constructor"><a href="https://tc39.es/ecma402/#sec-intl-datetimeformat-constructor">%Intl.DateTimeFormat%</a></emu-xref>.<var class="field">[[LocaleData]]</var>, <var>locales</var>, <var>options</var>, « <emu-const>coerce-options</emu-const>&nbsp;», <var>modifyResolutionOptions</var>).</li><li>Set <var>options</var> to <var>optionsResolution</var>.<var class="field">[[Options]]</var>.</li><li>Let <var>r</var> be <var>optionsResolution</var>.<var class="field">[[ResolvedLocale]]</var>.</li><li>Set <var>dateTimeFormat</var>.<var class="field">[[Locale]]</var> to <var>r</var>.<var class="field">[[Locale]]</var>.</li><li>Let <var>resolvedCalendar</var> be <var>r</var>.<var class="field">[[ca]]</var>.</li><li><ins>If <var>resolvedCalendar</var> is <emu-val>"islamic"</emu-val> or <emu-val>"islamic-rgsa"</emu-val>, then</ins><ol><li><ins>Let <var>fallbackCalendar</var> be an implementation- and locale-defined <emu-xref href="#sec-ecma402-calendar-types" id="_ref_13"><a href="#sec-ecma402-calendar-types">calendar type</a></emu-xref> that is one of the values returned from <emu-xref aoid="AvailableCalendars" id="_ref_14"><a href="#sup-availablecalendars">AvailableCalendars</a></emu-xref>.</ins></li><li><ins>Set <var>resolvedCalendar</var> to <emu-xref aoid="CanonicalizeUValue"><a href="https://tc39.es/ecma402/#sec-canonicalizeuvalue">CanonicalizeUValue</a></emu-xref>(<emu-val>"ca"</emu-val>, <var>fallbackCalendar</var>).</ins></li></ol></li><li>Set <var>dateTimeFormat</var>.<var class="field">[[Calendar]]</var> to <var>resolvedCalendar</var>.</li><li>NOTE: Rest of algorithm unchanged.</li></ol></emu-alg>
4142+
<emu-alg><ol><li>Let <var>dateTimeFormat</var> be ?&nbsp;<emu-xref aoid="OrdinaryCreateFromConstructor"><a href="https://tc39.es/ecma262/#sec-ordinarycreatefromconstructor">OrdinaryCreateFromConstructor</a></emu-xref>(<var>newTarget</var>, <emu-val>"%Intl.DateTimeFormat.prototype%"</emu-val>, « <var class="field">[[InitializedDateTimeFormat]]</var>, <var class="field">[[Locale]]</var>, <var class="field">[[Calendar]]</var>, <var class="field">[[NumberingSystem]]</var>, <var class="field">[[TimeZone]]</var>, <var class="field">[[HourCycle]]</var>, <var class="field">[[DateStyle]]</var>, <var class="field">[[TimeStyle]]</var>, <var class="field">[[DateTimeFormat]]</var>, <var class="field">[[BoundFormat]]</var>&nbsp;»).</li><li>Let <var>hour12</var> be <emu-val>undefined</emu-val>.</li><li>Let <var>modifyResolutionOptions</var> be a new <emu-xref href="#sec-abstract-closure"><a href="https://tc39.es/ecma262/#sec-abstract-closure">Abstract Closure</a></emu-xref> with parameters (<var>options</var>) that captures <var>hour12</var> and performs the following steps when called:<ol><li>Set <var>hour12</var> to <var>options</var>.<var class="field">[[hour12]]</var>.</li><li>Remove field <var class="field">[[hour12]]</var> from <var>options</var>.</li><li>If <var>hour12</var> is not <emu-val>undefined</emu-val>, set <var>options</var>.<var class="field">[[hc]]</var> to <emu-val>null</emu-val>.</li></ol></li><li>Let <var>optionsResolution</var> be ?&nbsp;<emu-xref aoid="ResolveOptions"><a href="https://tc39.es/ecma402/#sec-resolveoptions">ResolveOptions</a></emu-xref>(<emu-xref href="#sec-intl-datetimeformat-constructor"><a href="https://tc39.es/ecma402/#sec-intl-datetimeformat-constructor">%Intl.DateTimeFormat%</a></emu-xref>, <emu-xref href="#sec-intl-datetimeformat-constructor"><a href="https://tc39.es/ecma402/#sec-intl-datetimeformat-constructor">%Intl.DateTimeFormat%</a></emu-xref>.<var class="field">[[LocaleData]]</var>, <var>locales</var>, <var>options</var>, « <emu-const>coerce-options</emu-const>&nbsp;», <var>modifyResolutionOptions</var>).</li><li>Set <var>options</var> to <var>optionsResolution</var>.<var class="field">[[Options]]</var>.</li><li>Let <var>r</var> be <var>optionsResolution</var>.<var class="field">[[ResolvedLocale]]</var>.</li><li>Set <var>dateTimeFormat</var>.<var class="field">[[Locale]]</var> to <var>r</var>.<var class="field">[[Locale]]</var>.</li><li>Let <var>resolvedCalendar</var> be <var>r</var>.<var class="field">[[ca]]</var>.</li><li><ins>If <var>resolvedCalendar</var> is <emu-val>"islamic"</emu-val> or <emu-val>"islamic-rgsa"</emu-val>, then</ins><ol><li><ins>Let <var>fallbackCalendar</var> be an implementation- and locale-defined <emu-xref href="#sec-ecma402-calendar-types" id="_ref_13"><a href="#sec-ecma402-calendar-types">calendar type</a></emu-xref> that is one of the values returned from <emu-xref aoid="AvailableCalendars" id="_ref_14"><a href="#sup-availablecalendars">AvailableCalendars</a></emu-xref>.</ins></li><li><ins>Set <var>resolvedCalendar</var> to <emu-xref aoid="CanonicalizeUValue"><a href="https://tc39.es/ecma402/#sec-canonicalizeuvalue">CanonicalizeUValue</a></emu-xref>(<emu-val>"ca"</emu-val>, <var>fallbackCalendar</var>).</ins></li><li><ins>If the ECMAScript implementation has a mechanism for reporting diagnostic warning messages, a warning should be issued.</ins></li></ol></li><li>Set <var>dateTimeFormat</var>.<var class="field">[[Calendar]]</var> to <var>resolvedCalendar</var>.</li><li>NOTE: Rest of algorithm unchanged.</li></ol></emu-alg>
41434143
</emu-clause>
41444144
</emu-clause>
41454145

spec.emu

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,7 @@ contributors: Google, Ecma International
181181
1. <ins>If _resolvedCalendar_ is *"islamic"* or *"islamic-rgsa"*, then</ins>
182182
1. <ins>Let _fallbackCalendar_ be an implementation- and locale-defined calendar type that is one of the values returned from AvailableCalendars.</ins>
183183
1. <ins>Set _resolvedCalendar_ to CanonicalizeUValue(*"ca"*, _fallbackCalendar_).</ins>
184+
1. <ins>If the ECMAScript implementation has a mechanism for reporting diagnostic warning messages, a warning should be issued.</ins>
184185
1. Set _dateTimeFormat_.[[Calendar]] to _resolvedCalendar_.
185186
1. NOTE: Rest of algorithm unchanged.
186187
</emu-alg>

0 commit comments

Comments
 (0)