You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Editorial: Address high-priority points from TG2 editor review (#97)
* Editorial: Add definitions for "arithmetic year" and "epoch year"
The definitions link to the description of the [[Year]] field in
Calendar Date Records, where arithmetic year and epoch year are
explained.
Also adjusts the text in a few places to avoid repetition now that we
have linked definitions, and adds a cross-reference to the table of
epoch years.
See: #51
* Editorial: Clarify that calendars not in Table 1 are implementation-defined
Implementations should not be constrained to just the calendar types in
Table 1, for future extensibility. In any abstract operations that seem
to assume that all calendar types are listed in Table 1, add language
clarifying what happens if they are not.
See: #51Closes: #94
* Editorial: Clarify that eras in Table 2 are the currently known ones
Refer to UTS 35 as the canonical source for this data. Add Part 4: Dates
to the list of normative references, in order to clarify that
implementations do not have to omit newly added eras in order to be
conformant, as well as for the note below about updating on a best-
effort basis.
* Editorial: Update table-eras caption
Suggestion from code review.
Co-Authored-By: Richard Gibson <[email protected]>
---------
Co-authored-by: Richard Gibson <[email protected]>
Copy file name to clipboardExpand all lines: spec.emu
+93-19Lines changed: 93 additions & 19 deletions
Original file line number
Diff line number
Diff line change
@@ -199,7 +199,7 @@ contributors: Google, Ecma International
199
199
<p>The value of the [[LocaleData]] internal slot is implementation-defined within the constraints described in <emu-xref href="#sec-internal-slots"></emu-xref> and the following additional constraints, for all locale values _locale_:</p>
200
200
201
201
<ul>
202
-
<li><ins>[[LocaleData]].[[<_locale_>]].[[ca]] must be a List consisting of values from the Calendar Type column of <emu-xref href="#table-calendar-types"></emu-xref>. The list may also include *"islamic"* and *"islamic-rgsa"*.</ins></li>
202
+
<li><ins>[[LocaleData]].[[<_locale_>]].[[ca]] must be a List consisting of calendar types. Specifically, even if supporting only the calendars from <emu-xref href="#table-calendar-types"></emu-xref>, the list may also include *"islamic"* and *"islamic-rgsa"*.</ins></li>
203
203
<li>
204
204
[[LocaleData]].[[<_locale_>]].[[nu]] must be a List that does not include the values *"native"*, *"traditio"*, or *"finance"*.
205
205
</li>
@@ -227,20 +227,24 @@ contributors: Google, Ecma International
227
227
<dl class="header">
228
228
<dt>description</dt>
229
229
<dd>
230
-
The following algorithm refers to the era data from <a href="https://unicode.org/reports/tr35/tr35-dates.html#Calendar_Data">UTS 35's Supplemental Calendar Data</a>.
230
+
The following algorithm refers (via <emu-xref href="#table-eras"></emu-xref>) to the era data from <a href="https://unicode.org/reports/tr35/tr35-dates.html#Calendar_Data">UTS 35's Supplemental Calendar Data</a>.
231
231
</dd>
232
232
</dl>
233
233
<emu-alg>
234
234
1. If _calendar_ is listed in the Calendar column of <emu-xref href="#table-eras"></emu-xref>, return *true*.
235
-
1. Return *false*.
235
+
1. If _calendar_ is listed in the Calendar Type column of <emu-xref href="#table-calendar-types"></emu-xref>, return *false*.
236
+
1. Return an implementation-defined value.
236
237
</emu-alg>
237
-
<p><emu-xref href="#table-eras"></emu-xref> lists all possible eras for the current set of calendars, including their aliases, ranges and kinds.
238
-
The era kind is used by <emu-xref href="#sec-temporal-calendardatearithmeticyearforerayear">CalendarDateArithmeticYearForEraYear</emu-xref> to calculate arithmetic year ([[Year]]):
238
+
<p>
239
+
<emu-xref href="#table-eras"></emu-xref> lists all currently known eras for the current set of calendars, including their aliases, ranges and kinds.
240
+
The canonical source for this table is the data described in <a href="https://unicode.org/reports/tr35/tr35-dates.html#Calendar_Data">Unicode Technical Standard #35 Part 4 Dates, Calendar Data</a>.
241
+
</p>
242
+
<p>The era kind is used by <emu-xref href="#sec-temporal-calendardatearithmeticyearforerayear">CalendarDateArithmeticYearForEraYear</emu-xref> to calculate arithmetic year ([[Year]]):
239
243
An *Era kind* ~epoch~ means that the era is the epoch era, so 1 Era has an arithmetic year of 1. An *Era kind* ~negative~ means that the era is a "negative" era growing
240
244
from the epoch, so 1 Era is an arithmetic year of 0, and larger [[EraYear]] values produce smaller, negative arithmetic years. An *Era kind* of
241
245
~offset~ means that the era is "offset" by a given number (in the *Offset* column), so 1 Era has an arithmetic year of *Offset*.</p>
242
246
<emu-table id="table-eras">
243
-
<emu-caption>era aliases, range of eraYear, and era kinds</emu-caption>
247
+
<emu-caption>Eras</emu-caption>
244
248
<table class="real-table">
245
249
<thead>
246
250
<tr>
@@ -503,7 +507,8 @@ contributors: Google, Ecma International
503
507
1. If _canonicalName_ is equal to _era_, return _canonicalName_.
504
508
1. Let _aliases_ be a List whose elements are the strings given in the Aliases column of the row.
505
509
1. If _aliases_ contains _era_, return _canonicalName_.
506
-
1. Return *undefined*.
510
+
1. If _calendar_ is listed in the Calendar Type column of <emu-xref href="#table-calendar-types"></emu-xref>, return *undefined*.
511
+
1. Return an implementation-defined value.
507
512
</emu-alg>
508
513
</emu-clause>
509
514
@@ -519,7 +524,8 @@ contributors: Google, Ecma International
519
524
</dl>
520
525
<emu-alg>
521
526
1. If _calendar_ is *"japanese"*, return *true*.
522
-
1. Return *false*.
527
+
1. If _calendar_ is listed in the Calendar Type column of <emu-xref href="#table-calendar-types"></emu-xref>, return *false*.
528
+
1. Return an implementation-defined value.
523
529
</emu-alg>
524
530
</emu-clause>
525
531
@@ -535,11 +541,13 @@ contributors: Google, Ecma International
535
541
<emu-alg>
536
542
1. Let _commonMonthCodes_ be « *"M01"*, *"M02"*, *"M03"*, *"M04"*, *"M05"*, *"M06"*, *"M07"*, *"M08"*, *"M09"*, *"M10"*, *"M11"*, *"M12"* ».
537
543
1. If _commonMonthCodes_ contains _monthCode_, return *true*.
538
-
1. If _calendar_ is not listed in the Calendar column of <emu-xref href="#table-additional-month-codes"></emu-xref>, return *false*.
539
-
1. Let _r_ be the row in <emu-xref href="#table-additional-month-codes"></emu-xref> which the _calendar_ is in the Calendar column.
540
-
1. Let _specialMonthCodes_ be a List whose elements are the strings given in the *"Additional Month Codes"* column of _r_.
541
-
1. If _specialMonthCodes_ contains _monthCode_, return *true*.
542
-
1. Return *false*.
544
+
1. If _calendar_ is listed in the Calendar column of <emu-xref href="#table-additional-month-codes"></emu-xref>, then
545
+
1. Let _r_ be the row in <emu-xref href="#table-additional-month-codes"></emu-xref> which the _calendar_ is in the Calendar column.
546
+
1. Let _specialMonthCodes_ be a List whose elements are the strings given in the *"Additional Month Codes"* column of _r_.
547
+
1. If _specialMonthCodes_ contains _monthCode_, return *true*.
548
+
1. Return *false*.
549
+
1. If _calendar_ is listed in the Calendar Type column of <emu-xref href="#table-calendar-types"></emu-xref>, return *false*.
550
+
1. Return an implementation-defined value.
543
551
</emu-alg>
544
552
545
553
<emu-table id="table-additional-month-codes">
@@ -628,6 +636,7 @@ contributors: Google, Ecma International
628
636
1. Assert: IsValidMonthCodeForCalendar(_calendar_, _monthCode_) is *true*.
629
637
1. If YearContainsMonthCode(_calendar_, _arithmeticYear_, _monthCode_) is *true*, return _monthCode_.
630
638
1. If _overflow_ is ~reject~, throw a *RangeError* exception.
639
+
1. If _calendar_ is not listed in the Calendar Type column of <emu-xref href="#table-calendar-types"></emu-xref>, return an implementation-defined value.
631
640
1. Assert: _calendar_ is listed in the Calendar column of <emu-xref href="#table-additional-month-codes"></emu-xref>.
632
641
1. Let _r_ be the row in <emu-xref href="#table-additional-month-codes"></emu-xref> which the _calendar_ is in the Calendar column.
633
642
1. Let _shiftType_ be the value given in the *"Leap to Common Month Transformation"* column of _r_.
@@ -659,6 +668,7 @@ contributors: Google, Ecma International
659
668
1. Let _monthsBefore_ be 0.
660
669
1. Let _number_ be 1.
661
670
1. Let _isLeap_ be *false*.
671
+
1. If _calendar_ is not listed in the Calendar Type column of <emu-xref href="#table-calendar-types"></emu-xref>, return an implementation-defined value.
662
672
1. Let _r_ be the row in <emu-xref href="#table-additional-month-codes"></emu-xref> which the _calendar_ is in the Calendar column.
663
673
1. If the *"Leap to Common Month Transformation"* column of _r_ is empty, then
@@ -745,9 +755,10 @@ contributors: Google, Ecma International
745
755
</h1>
746
756
<dl class="header">
747
757
<dt>description</dt>
748
-
<dd>It performs implementation-defined processing to find the year for the date corresponding to _date_ in the context of the calendar represented by _calendar_ relative to a well-defined epoch year for that calendar.</dd>
758
+
<dd>It performs implementation-defined processing to find the arithmetic year for the date corresponding to _date_ in the context of the calendar represented by _calendar_.</dd>
749
759
</dl>
750
760
<emu-alg>
761
+
1. If _calendar_ is not listed in the Calendar Type column of <emu-xref href="#table-calendar-types"></emu-xref>, return an implementation-defined value.
751
762
1. Let _r_ be the row in <emu-xref href="#table-epoch-years"></emu-xref> which the value of the Calendar column is _calendar_.
752
763
1. Let _epochYear_ be the value given in the *"Epoch ISO Year"* column of _r_.
753
764
1. Let _epochDate_ be the first day of the calendar year starting in ISO year _epochYear_ in the calendar represented by _calendar_, according to implementation-defined processing.
@@ -757,7 +768,7 @@ contributors: Google, Ecma International
757
768
</emu-alg>
758
769
759
770
<emu-table id="table-epoch-years">
760
-
<emu-caption>epoch years</emu-caption>
771
+
<emu-caption>Epoch years</emu-caption>
761
772
<table class="real-table">
762
773
<thead>
763
774
<tr>
@@ -828,6 +839,7 @@ contributors: Google, Ecma International
@@ -838,11 +850,12 @@ contributors: Google, Ecma International
838
850
</h1>
839
851
<dl class="header">
840
852
<dt>description</dt>
841
-
<dd>It produces the year relative to the epoch year (the arithmetic year) for a given set of _era_, _eraYear_ in _calendar_, a calendar that includes an era named _era_.</dd>
853
+
<dd>It produces the arithmetic year for a given set of _era_, _eraYear_ in _calendar_, a calendar that includes an era named _era_.</dd>
842
854
</dl>
843
855
<emu-alg>
844
856
1. Let _era_ be CanonicalizeEraInCalendar(_calendar_, _era_).
845
857
1. Assert: _era_ is not *undefined*.
858
+
1. If _calendar_ is not listed in the Calendar Type column of <emu-xref href="#table-calendar-types"></emu-xref>, return an implementation-defined value.
846
859
1. Let _r_ be the row in <emu-xref href="#table-eras"></emu-xref> in which _calendar_ is in the Calendar column and _era_ is in the Era column.
847
860
1. Let _eraKind_ be the value given in the *"Era kind"* column of _r_.
848
861
1. Let _offset_ be the value given in the *"Offset"* column of _r_.
@@ -915,9 +928,9 @@ contributors: Google, Ecma International
915
928
<td>[[Year]]</td>
916
929
<td>an integer</td>
917
930
<td>
918
-
The date's yearrelative to the first day of a calendar-specific "epoch year".<br>
931
+
The date's <dfn>arithmetic year</dfn>, which is the year relative to the first day of a calendar-specific <dfn>epoch year</dfn>, given in <emu-xref href="#table-epoch-years"></emu-xref>.<br>
919
932
The value of this field for a calendar type _calendar_ should be the result of calling CalendarDateArithmeticYear(_calendar_, _date_), where _date_ is the [[ISODate]] field of a Temporal.PlainDateTime, Temporal.PlainDate, or Temporal.PlainYearMonth value corresponding to the date.
920
-
<emu-note>The year is relative to the first day of the calendar's epoch year, so if the epoch era starts in the middle of the year, the year will be the same value before and after the start date of the era.</emu-note>
933
+
<emu-note>The arithmetic year is relative to the first day of the calendar's epoch year, so if the epoch era starts in the middle of the year, the year will be the same value before and after the start date of the era.</emu-note>
921
934
</td>
922
935
</tr>
923
936
<tr>
@@ -967,7 +980,7 @@ contributors: Google, Ecma International
967
980
<td>
968
981
<p>The date's <em>calendar week of year</em>, and the corresponding <em>week calendar year</em>.</p>
969
982
<p>The Year-Week Record's [[Week]] field should be 1-based.</p>
970
-
<p>The Year-Week Record's [[Year]] field is relative to the first day of a calendar-specific "epoch year", as in the Calendar Date Record's [[Year]] field, not relative to an era as in [[EraYear]].</p>
983
+
<p>The Year-Week Record's [[Year]] field is an arithmetic year as in the Calendar Date Record's [[Year]] field, not relative to an era as in [[EraYear]].</p>
971
984
<p>
972
985
Usually the Year-Week Record's [[Year]] field will contain the same value as the Calendar Date Record's [[Year]] field, but may contain the previous or next year if the week number in the Year-Week Record's [[Week]] field overlaps two different years.
973
986
See also ISOWeekOfYear.
@@ -1288,6 +1301,7 @@ contributors: Google, Ecma International
1288
1301
<p>This definition supersedes the definition provided in <emu-xref href="#sec-temporal-calendarextrafields"></emu-xref>.</p>
1289
1302
<p>It performs the following steps when called:</p>
1290
1303
<emu-alg>
1304
+
1. If _calendar_ is not listed in the Calendar Type column of <emu-xref href="#table-calendar-types"></emu-xref>, return an implementation-defined value.
1291
1305
1. If _fields_ contains an element equal to ~year~ and CalendarSupportsEra(_calendar_) is *true*, then
1292
1306
1. Append ~era~ and ~era-year~ to _fields_.
1293
1307
1. Return _fields_.
@@ -1311,6 +1325,7 @@ contributors: Google, Ecma International
1311
1325
<p>This definition supersedes the definition provided in <emu-xref href="#sec-temporal-nonisofieldkeystoignore"></emu-xref>.</p>
1312
1326
<p>It performs the following steps when called:</p>
1313
1327
<emu-alg>
1328
+
1. If _calendar_ is not listed in the Calendar Type column of <emu-xref href="#table-calendar-types"></emu-xref>, return an implementation-defined value.
1314
1329
1. Let _ignoredKeys_ be an empty List.
1315
1330
1. For each element _key_ of _keys_, do
1316
1331
1. If _key_ is ~month~, append ~month-code~ to _ignoredKeys_.
@@ -1327,3 +1342,62 @@ contributors: Google, Ecma International
1327
1342
</emu-clause>
1328
1343
</emu-clause>
1329
1344
</emu-clause>
1345
+
1346
+
<emu-clause id="normative-references">
1347
+
<h1>Normative References</h1>
1348
+
<p>The following referenced documents are required for the application of this document. For dated references, only the edition cited applies. For undated references, the latest edition of the referenced document (including any amendments) applies.</p>
1349
+
1350
+
<p>
1351
+
ECMAScript 2026 Language Specification (<dfn id="ecma262">ECMA-262</dfn> 17<sup>th</sup> Edition, or successor).<br>
ISO/IEC 10646:2014: Information Technology – Universal Multiple-Octet Coded Character Set (UCS) plus Amendment 1:2015 and Amendment 2, plus additional amendments and corrigenda, or successor
<a href="https://www.iso.org/iso/iso_catalogue/catalogue_tc/catalogue_detail.htm?csnumber=64758">ISO 4217:2015, Codes for the representation of currencies and funds, or successor</a>
1366
+
</li>
1367
+
<li>
1368
+
<a href="https://tools.ietf.org/html/rfc4647">IETF RFC 4647, Matching of Language Tags, or successor</a>
1369
+
</li>
1370
+
<li>
1371
+
<a href="https://www.iana.org/time-zones/">IANA Time Zone Database</a>
Sections of this specification that depend on these references are updated on a best-effort basis, but are not guaranteed to be up-to-date with those standards.
0 commit comments