Title: [294050] trunk
Revision
294050
Author
ross.kirsl...@sony.com
Date
2022-05-10 21:27:58 -0700 (Tue, 10 May 2022)

Log Message

[Temporal] Years 0-999 should be canonically represented with 4 digits, not 6
https://bugs.webkit.org/show_bug.cgi?id=240294

Reviewed by Yusuke Suzuki.

This patch implements the spec change of https://github.com/tc39/proposal-temporal/issues/2082:
The range for 4-digit years in ISO8601 date strings should be 0-9999, not 1000-9999.

* test262/expectations.yaml:
Mark four test cases as passing.

* runtime/TemporalInstant.cpp:

Canonical link: https://commits.webkit.org/250456@main

Modified Paths

Diff

Modified: trunk/JSTests/ChangeLog (294049 => 294050)


--- trunk/JSTests/ChangeLog	2022-05-11 01:07:49 UTC (rev 294049)
+++ trunk/JSTests/ChangeLog	2022-05-11 04:27:58 UTC (rev 294050)
@@ -1,3 +1,13 @@
+2022-05-10  Ross Kirsling  <ross.kirsl...@sony.com>
+
+        [Temporal] Years 0-999 should be canonically represented with 4 digits, not 6
+        https://bugs.webkit.org/show_bug.cgi?id=240294
+
+        Reviewed by Yusuke Suzuki.
+
+        * test262/expectations.yaml:
+        Mark four test cases as passing.
+
 2022-05-09  Yusuke Suzuki  <ysuz...@apple.com>
 
         Upstream TypedArray.prototype.fill speedup from bun

Modified: trunk/JSTests/test262/expectations.yaml (294049 => 294050)


--- trunk/JSTests/test262/expectations.yaml	2022-05-11 01:07:49 UTC (rev 294049)
+++ trunk/JSTests/test262/expectations.yaml	2022-05-11 04:27:58 UTC (rev 294050)
@@ -1050,9 +1050,6 @@
 test/built-ins/Temporal/Instant/prototype/toJSON/timezone-getoffsetnanosecondsfor-not-callable.js:
   default: 'Test262Error: Uncallable undefined getOffsetNanosecondsFor should throw TypeError Expected a TypeError to be thrown but no exception was thrown at all'
   strict mode: 'Test262Error: Uncallable undefined getOffsetNanosecondsFor should throw TypeError Expected a TypeError to be thrown but no exception was thrown at all'
-test/built-ins/Temporal/Instant/prototype/toJSON/year-format.js:
-  default: 'Test262Error: year 0 formatted as 4-digit Expected SameValue(«+000000-07-01T21:30:36Z», «0000-07-01T21:30:36Z») to be true'
-  strict mode: 'Test262Error: year 0 formatted as 4-digit Expected SameValue(«+000000-07-01T21:30:36Z», «0000-07-01T21:30:36Z») to be true'
 test/built-ins/Temporal/Instant/prototype/toString/rounding-direction.js:
   default: 'Test262Error: Rounding down is towards the Big Bang, not the epoch or 1 BCE (roundingMode trunc) Expected SameValue(«-000099-12-15T12:00:01Z», «-000099-12-15T12:00:00Z») to be true'
   strict mode: 'Test262Error: Rounding down is towards the Big Bang, not the epoch or 1 BCE (roundingMode trunc) Expected SameValue(«-000099-12-15T12:00:01Z», «-000099-12-15T12:00:00Z») to be true'
@@ -1068,9 +1065,6 @@
 test/built-ins/Temporal/Instant/prototype/toString/timezone-string-multiple-offsets.js:
   default: 'RangeError: argument needs to be UTC offset string, TimeZone identifier, or temporal Instant string'
   strict mode: 'RangeError: argument needs to be UTC offset string, TimeZone identifier, or temporal Instant string'
-test/built-ins/Temporal/Instant/prototype/toString/year-format.js:
-  default: 'Test262Error: year 0 formatted as 4-digit Expected SameValue(«+000000-07-01T21:30:36Z», «0000-07-01T21:30:36Z») to be true'
-  strict mode: 'Test262Error: year 0 formatted as 4-digit Expected SameValue(«+000000-07-01T21:30:36Z», «0000-07-01T21:30:36Z») to be true'
 test/built-ins/Temporal/PlainTime/compare/argument-cast.js:
   default: 'TypeError: "microsecond" field is missing'
   strict mode: 'TypeError: "microsecond" field is missing'

Modified: trunk/Source/_javascript_Core/ChangeLog (294049 => 294050)


--- trunk/Source/_javascript_Core/ChangeLog	2022-05-11 01:07:49 UTC (rev 294049)
+++ trunk/Source/_javascript_Core/ChangeLog	2022-05-11 04:27:58 UTC (rev 294050)
@@ -1,3 +1,15 @@
+2022-05-10  Ross Kirsling  <ross.kirsl...@sony.com>
+
+        [Temporal] Years 0-999 should be canonically represented with 4 digits, not 6
+        https://bugs.webkit.org/show_bug.cgi?id=240294
+
+        Reviewed by Yusuke Suzuki.
+
+        This patch implements the spec change of https://github.com/tc39/proposal-temporal/issues/2082:
+        The range for 4-digit years in ISO8601 date strings should be 0-9999, not 1000-9999.
+
+        * runtime/TemporalInstant.cpp:
+
 2022-05-09  Yusuke Suzuki  <ysuz...@apple.com>
 
         Upstream TypedArray.prototype.fill speedup from bun

Modified: trunk/Source/_javascript_Core/runtime/TemporalInstant.cpp (294049 => 294050)


--- trunk/Source/_javascript_Core/runtime/TemporalInstant.cpp	2022-05-11 01:07:49 UTC (rev 294049)
+++ trunk/Source/_javascript_Core/runtime/TemporalInstant.cpp	2022-05-11 04:27:58 UTC (rev 294050)
@@ -457,10 +457,10 @@
     GregorianDateTime gregorianDateTime { static_cast<double>(exactTime.epochMilliseconds()), LocalTimeOffset { } };
     StringBuilder builder;
 
-    // If the year is outside the bounds of 1000 and 9999 inclusive we want to
+    // If the year is outside the bounds of 0 and 9999 inclusive we want to
     // use the extended year format (PadISOYear).
     unsigned yearLength = 4;
-    if (gregorianDateTime.year() > 9999 || gregorianDateTime.year() < 1000) {
+    if (gregorianDateTime.year() > 9999 || gregorianDateTime.year() < 0) {
         builder.append(gregorianDateTime.year() < 0 ? '-' : '+');
         yearLength = 6;
     }
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to