|
5 | 5 | <h1>Temporal.Calendar Objects</h1>
|
6 | 6 | <p>A Temporal.Calendar object is an Object representing a calendar.</p>
|
7 | 7 |
|
| 8 | + <emu-clause id="sec-calendar-types"> |
| 9 | + <h1>Calendar Types</h1> |
| 10 | + |
| 11 | + <emu-note type="editor"> |
| 12 | + <p> |
| 13 | + This section shares some text with the <a href="https://tc39.es/proposal-intl-enumeration/">Intl.Enumeration proposal</a>. |
| 14 | + </p> |
| 15 | + </emu-note> |
| 16 | + |
| 17 | + <p> |
| 18 | + At a minimum, ECMAScript implementations must support a built-in calendar named *"iso8601"*, representing the ISO 8601 calendar. |
| 19 | + In addition, implementations may support any number of other built-in calendars. |
| 20 | + </p> |
| 21 | + <p> |
| 22 | + ECMAScript implementations identify built-in calendars using a <dfn variants="calendar types">calendar type</dfn> as defined by <a href="https://unicode.org/reports/tr35/tr35-dates.html#Calendar_Elements">Unicode Technical Standard #35, Part 4, Section 2</a>. |
| 23 | + Their canonical form is a string containing all lower case letters with zero or more hyphens. |
| 24 | + </p> |
| 25 | + <p> |
| 26 | + <emu-xref href="#sec-temporal-calendar-constructor">The `Temporal.Calendar` constructor</emu-xref>, when called with the name of a built-in calendar as the argument, will return a valid `Temporal.Calendar` object. |
| 27 | + When called with any other string, it will throw a *RangeError* exception. |
| 28 | + </p> |
| 29 | + |
| 30 | + <emu-clause id="sec-temporal-isbuiltincalendar" type="abstract operation"> |
| 31 | + <h1> |
| 32 | + IsBuiltinCalendar ( |
| 33 | + _id_: a String, |
| 34 | + ): a Boolean |
| 35 | + </h1> |
| 36 | + <dl class="header"> |
| 37 | + <dt>description</dt> |
| 38 | + <dd>The returned value is *true* if _id_ is a calendar type denoting a built-in calendar, and *false* otherwise.</dd> |
| 39 | + </dl> |
| 40 | + <emu-alg> |
| 41 | + 1. Let _calendars_ be AvailableCalendars(). |
| 42 | + 1. If _calendars_ contains _id_, return *true*. |
| 43 | + 1. Return *false*. |
| 44 | + </emu-alg> |
| 45 | + </emu-clause> |
| 46 | + |
| 47 | + <emu-clause id="sec-temporal-availablecalendars" type="abstract operation"> |
| 48 | + <h1> |
| 49 | + AvailableCalendars ( |
| 50 | + ): a List of Strings |
| 51 | + </h1> |
| 52 | + <dl class="header"> |
| 53 | + <dt>description</dt> |
| 54 | + <dd>The returned List contains a single calendar type, *"iso8601"*.</dd> |
| 55 | + </dl> |
| 56 | + |
| 57 | + <p> |
| 58 | + An ECMAScript implementation that includes the ECMA-402 Internationalization API must implement the AvailableCalendars abstract operation as specified in the ECMA-402 specification. |
| 59 | + If an ECMAScript implementation does not include the ECMA-402 API the following specification of the AvailableCalendars abstract operation is used. |
| 60 | + </p> |
| 61 | + <emu-alg> |
| 62 | + 1. Return « *"iso8601"* ». |
| 63 | + </emu-alg> |
| 64 | + </emu-clause> |
| 65 | + </emu-clause> |
| 66 | + |
8 | 67 | <emu-clause id="sec-temporal-calendar-abstract-ops">
|
9 | 68 | <h1>Abstract Operations for Temporal.Calendar Objects</h1>
|
10 | 69 |
|
11 | 70 | <emu-clause id="sec-temporal-createtemporalcalendar" aoid="CreateTemporalCalendar">
|
12 | 71 | <h1>CreateTemporalCalendar ( _identifier_ [ , _newTarget_ ] )</h1>
|
13 | 72 | <emu-alg>
|
14 |
| - 1. Assert: ! IsBuiltinCalendar(_identifier_) is *true*. |
| 73 | + 1. Assert: IsBuiltinCalendar(_identifier_) is *true*. |
15 | 74 | 1. If _newTarget_ is not provided, set _newTarget_ to %Temporal.Calendar%.
|
16 | 75 | 1. Let _object_ be ? OrdinaryCreateFromConstructor(_newTarget_, *"%Temporal.Calendar.prototype%"*, « [[InitializedTemporalCalendar]], [[Identifier]] »).
|
17 | 76 | 1. Set _object_.[[Identifier]] to _identifier_.
|
18 | 77 | 1. Return _object_.
|
19 | 78 | </emu-alg>
|
20 | 79 | </emu-clause>
|
21 | 80 |
|
22 |
| - <emu-clause id="sec-temporal-isbuiltincalendar" aoid="IsBuiltinCalendar"> |
23 |
| - <h1>IsBuiltinCalendar ( _id_ )</h1> |
24 |
| - <p> |
25 |
| - An ECMAScript implementation that includes the ECMA-402 Internationalization API must implement the *IsBuiltinCalendar* abstract operation as specified in the ECMA-402 specification. |
26 |
| - If an ECMAScript implementation does not include the ECMA-402 API the following specification of the *IsBuiltinCalendar* abstract operation is used. |
27 |
| - </p> |
28 |
| - <emu-alg> |
29 |
| - 1. If _id_ is not *"iso8601"*, return *false*. |
30 |
| - 1. Return *true*. |
31 |
| - </emu-alg> |
32 |
| - </emu-clause> |
33 |
| - |
34 | 81 | <emu-clause id="sec-temporal-getbuiltincalendar" aoid="GetBuiltinCalendar">
|
35 | 82 | <h1>GetBuiltinCalendar ( _id_ )</h1>
|
36 | 83 | <emu-alg>
|
37 |
| - 1. If ! IsBuiltinCalendar(_id_) is *false*, throw a *RangeError* exception. |
| 84 | + 1. If IsBuiltinCalendar(_id_) is *false*, throw a *RangeError* exception. |
38 | 85 | 1. Return ! CreateTemporalCalendar(_id_).
|
39 | 86 | </emu-alg>
|
40 | 87 | </emu-clause>
|
@@ -249,9 +296,9 @@ <h1>ToTemporalCalendar ( _temporalCalendarLike_ )</h1>
|
249 | 296 | 1. Set _temporalCalendarLike_ to ? Get(_temporalCalendarLike_, *"calendar"*).
|
250 | 297 | 1. If Type(_temporalCalendarLike_) is Object and ? HasProperty(_temporalCalendarLike_, *"calendar"*) is *false*, return _temporalCalendarLike_.
|
251 | 298 | 1. Let _identifier_ be ? ToString(_temporalCalendarLike_).
|
252 |
| - 1. If ! IsBuiltinCalendar(_identifier_) is *false*, then |
| 299 | + 1. If IsBuiltinCalendar(_identifier_) is *false*, then |
253 | 300 | 1. Set _identifier_ to ? ParseTemporalCalendarString(_identifier_).
|
254 |
| - 1. If ! IsBuiltinCalendar(_identifier_) is *false*, throw a *RangeError* exception. |
| 301 | + 1. If IsBuiltinCalendar(_identifier_) is *false*, throw a *RangeError* exception. |
255 | 302 | 1. Return ! CreateTemporalCalendar(_identifier_).
|
256 | 303 | </emu-alg>
|
257 | 304 | </emu-clause>
|
@@ -671,7 +718,7 @@ <h1>Temporal.Calendar ( _id_ )</h1>
|
671 | 718 | 1. If NewTarget is *undefined*, then
|
672 | 719 | 1. Throw a *TypeError* exception.
|
673 | 720 | 1. Set _id_ to ? ToString(_id_).
|
674 |
| - 1. If ! IsBuiltinCalendar(_id_) is *false*, then |
| 721 | + 1. If IsBuiltinCalendar(_id_) is *false*, then |
675 | 722 | 1. Throw a *RangeError* exception.
|
676 | 723 | 1. Return ? CreateTemporalCalendar(_id_, NewTarget).
|
677 | 724 | </emu-alg>
|
|
0 commit comments