Shannon Booth
f5fd912d6d
LibJS/Tests: Add a bunch of rounding mode tests
2024-02-06 08:45:34 +01:00
Shannon Booth
a7316d3641
LibJS: Update Temporal RoundDuration AO to some spec changes
...
This commit effectively just does a bulk update of this function to the
spec. Since there have been so many spec changes, no specific change was
made in mind, and many FIXMEs have been left for where we are still out
of date.
These changes also appear to include a normative change to the temporal
spec which was previously resulting in timeouts for some tests, and is
now resulting in a timeout.
Furthermore, this also resolves some crashes by protecting against
division by zero, instead throwing a RangeError. This can only happen
when a custom calender is provided which returns funky values. See:
https://github.com/tc39/proposal-temporal/commit/ed85e9
Diff Tests:
+8 ✅ -4 💀 -4 💥 ️
2024-01-14 16:08:52 -07:00
Timothy Flynn
f8763c16b2
LibJS: Disable Temporal custom time zone test
...
This test has been flaky for quite some time. Disable it for now, and
revisit once we've caught up with the Temporal spec.
See also: b7676cc436
2023-10-18 16:29:27 -04:00
Timothy Flynn
b7676cc436
LibJS: Disable Temporal custom time zone test
...
This test has been flaky for quite some time. Disable it for now, and
revisit once we've caught up with the Temporal spec.
2023-08-27 15:26:40 -04:00
Daniel Bertalan
96b197ef46
LibJS/Temporal: Perform floating point arithmetic in RoundTime
...
The valid range for temporal values (`nsMinInstant`/`nsMaxInstant`)
means performing nanosecond-valued integers could lead to an overflow.
NB: Only the `roundingMode: "day"` case was affected, as all others were
already performing the division on floating-point `fractional_second`
values. I'm adding `.0` suffixes everywhere to make this fact clearer.
This adds a few local tests as well, as those are tested with sanitizers
enabled by default, unlike test262.
2023-07-01 06:51:25 +02:00
Ben Wiederhake
36ff6187f6
Everywhere: Change spelling of 'behaviour' to 'behavior'
...
"The official project language is American English […]."
5d2e915623/CONTRIBUTING.md (L30)
Here's a short statistic of the occurrences of the word "behavio(u)r":
$ git grep -IPioh 'behaviou?r' | sort | uniq -c | sort -n
2 BEHAVIOR
24 Behaviour
32 behaviour
407 Behavior
992 behavior
Therefore, it is clear that "behaviour" (56 occurrences) should be
regarded a typo, and "behavior" (1401 occurrences) should be preferred.
Note that The occurrences in LibJS are intentionally NOT changed,
because there are taken verbatim from the specification. Hence:
$ git grep -IPioh 'behaviou?r' | sort | uniq -c | sort -n
2 BEHAVIOR
10 behaviour
24 Behaviour
407 Behavior
1014 behavior
2023-05-07 01:05:09 +02:00
Luke Wilde
588dae8aa6
LibJS/Temporal: Allow annotations after YYYY-MM and MM-DD
...
This is a normative change in the Temporal spec.
See: 160e836
2023-02-11 18:42:32 +00:00
Luke Wilde
fa1416987a
LibJS: Add yearOfWeek calendar methods and properties
...
This is a normative change in the Temporal spec.
See:
- 7fa4d18
- caa941d
2022-12-26 09:30:36 +01:00
davidot
cf0d30add6
LibJS: Add a function to ensure calls are made within the same second
...
Before these tests could be flaky if they happened to be called around
the edge of a second. Now we try up to 5 times to execute the tests
while staying within the same second.
2022-12-03 23:04:08 +00:00
Linus Groh
b0e7d59b8b
LibJS: Throw on conversion from TimeZone to Calendar and vice versa
...
This is a normative change in the Temporal spec.
See: 2084e77
2022-12-02 02:04:13 +01:00
Luke Wilde
ac67077b57
LibJS: Fix length of PlainDateTime.withPlainTime
...
withPlainTime's argument is optional, so the length of the function is
actually 0.
2022-11-03 21:09:58 +00:00
Luke Wilde
b26b18a0bc
LibJS: Add timeZoneName: "critical" option to ZonedDateTime.toString()
...
This is a normative change in the Temporal spec.
See: d84937f
2022-11-03 19:15:50 +00:00
Luke Wilde
4a167cfbec
LibJS: Add calendarName: "critical" option to toString() methods
...
This is a normative change in the Temporal spec.
See: e715a50
2022-11-03 19:15:50 +00:00
Luke Wilde
192aa75279
LibJS: Align ISO 8601 grammar with annotations from IXDTF
...
This is a normative change in the Temporal spec.
See: c64b844
2022-11-03 19:15:50 +00:00
Timothy Flynn
27737f613c
LibTimeZone+LibJS: Update to TZDB version 2022e
...
https://mm.icann.org/pipermail/tz-announce/2022-October/000074.html
This version changes America/Chicago's transtion from LMT to CST from
1883 Nov 18 12:09:24 to 1883 Nov 18 18:00.
2022-10-18 16:01:44 +02:00
Linus Groh
4567ded8e4
LibJS: Reject relativeTo string such as "2022-08-18T17:01Z"
...
This is a normative change in the Temporal spec.
See: 2dc20bf
2022-10-17 12:56:05 +02:00
Luke Wilde
35c9e324b4
LibJS: Add fast path TimeZone conversion to PlainDate#toZonedDateTime
...
This is a normative chane in the Temporal spec.
See: fcab1af
2022-10-16 13:40:21 +02:00
Luke Wilde
707f12f927
LibJS: Remove extra property check from Instant#toZonedDateTimeISO
...
This is a normative change in the Temporal spec.
See: 7dfbd80
2022-10-16 13:40:21 +02:00
Luke Wilde
f7bb79d6d1
LibJS: Fast-path ToTemporalTimeZone when the argument is a TimeZone
...
This is a normative change in the Temporal spec.
See: 54cea53
2022-10-16 13:40:21 +02:00
Luke Wilde
8c3512d6ce
LibJS: Fast-path ToTemporalCalendar when the argument is a Calendar
...
This is a normative change in the Temporal spec.
See: 2a43b39
2022-10-16 13:40:21 +02:00
Luke Wilde
d5d1146cc3
LibJS/Temporal: Fix inconsistency in order of observable operations
...
This is a normative change in the Temporal spec.
See: a3a8237
2022-10-14 18:55:12 +02:00
davidot
1b0ca52c54
LibJS: Disallow one day long time zone offsets
...
This is a normative change in the Temporal spec.
See: 9cc8b29b
2022-10-14 11:23:50 +02:00
Luke Wilde
9643a5c63f
LibJS: Accept and ignore calendar annotation in Instant strings
...
This is a normative change in the Temporal spec.
See: 3cd9669
2022-08-25 23:07:08 +01:00
Luke Wilde
54bb6bf2c0
LibJS: Avoid calling ToString on calendar when calendarName is "never"
...
This is a normative change in the Temporal spec.
See:
- 6122f4e
- cf586bc
2022-08-25 21:11:23 +01:00
Linus Groh
6850f25840
LibJS: Support IANA legacy names in the Temporal ISO 8601 grammar
...
This is a normative change in the Temporal spec.
See: 2419680
2022-07-30 10:50:50 +01:00
Luke Wilde
1e829c4ea8
LibJS: Check PlainMonthDay is in the ISO date time limits in creation
...
This is a normative change in the Temporal spec.
See: 374305c
2022-07-22 17:10:03 +01:00
Luke Wilde
61847b3cef
LibJS: Disallow negative day lengths in ZonedDateTime.protoype.round
...
This is a normative change in the Temporal spec.
See: 6f04074
2022-07-22 17:10:03 +01:00
Linus Groh
3720f4bd8f
LibJS: Fix production for time zone name in time zone strings
...
This is a normative change in the Temporal spec.
See:
- caf013a
- fb7cfa6
2022-06-29 07:35:42 +01:00
Linus Groh
3beb7fc42f
LibJS/Tests: Correct pluralSmallestPluralDisallowedOptions largestUnit
2022-06-24 22:12:03 +01:00
Linus Groh
d9fc09c6e5
LibJS/Tests: Remove outdated FIXME
2022-06-17 21:06:01 +01:00
Linus Groh
569c2dc1d0
LibJS: Adjust order of operations in ISO{Date,MonthDay}FromFields
...
This is a normative change in the Temporal spec.
See: 7dd90dc
2022-06-15 17:49:20 +01:00
Linus Groh
e96df3b7a7
LibJS: Leverage PrepareTemporalFields in ToTemporalTimeRecord
...
This is an editorial change in the Temporal spec.
See: b5ba981
2022-06-15 17:49:20 +01:00
Linus Groh
4c77575ec5
LibJS: Simplify Temporal unit AOs
...
This is an editorial change in the Temporal spec.
See: 1b3d018
2022-06-10 12:39:11 +02:00
Luke Wilde
2b764b3594
LibJS: Remove faulty assertion in BalanceDurationRelative
...
This is an editorial change in the Temporal spec.
See: 66f7464
2022-05-16 20:48:41 +01:00
Linus Groh
51e01b5a80
LibJS: Remove redundant TemporalDateString production
...
This is an editorial change in the Temporal spec.
See: 41a8a5c
2022-05-16 20:28:26 +01:00
Linus Groh
b751f80166
LibJS: Change internal slots of Duration to store mathematical values
...
This is a normative change in the Temporal spec.
See: 1f3fba8
2022-05-08 01:01:32 +02:00
Linus Groh
8e175b4959
LibJS: Adjust ISO8601 representation for years between 1 BCE and 999 CE
...
This is a normative change in the Temporal spec.
See: 39eeecd
2022-03-31 17:09:10 +01:00
Linus Groh
b020b8eea2
LibJS: Handle Etc/GMT timezones properly in TimeZone{IANA,Bracketed}Name
...
This is a normative change in the Temporal spec.
See: 8c73780
2022-03-31 17:09:10 +01:00
Linus Groh
b5392f9e39
LibJS: Emit reference information for { calendarName: "always" } option
...
This is a normative change in the Temporal spec.
See: 4f7519a
2022-03-31 17:09:10 +01:00
Linus Groh
55f9733316
LibJS: Add missing check in ParseTemporalInstant
...
This is an editorial change in the Temporal spec.
See: baead4d
2022-03-10 23:20:39 +01:00
Linus Groh
54af3a5396
LibJS: Adjust grammar for DateExtendedYear to exclude -000000
...
This is an editorial change in the Temporal spec.
See: fb3e656
We lose the custom error message, but it's not the end of the world.
2022-03-10 23:20:39 +01:00
Linus Groh
2434d34644
LibJS/Tests: Add tests for '−000000' (U+2212) DateExtendedYear
...
I noticed we only have coverage for this with the ASCII minus sign in
our own test suite.
2022-03-09 22:08:15 +01:00
Timothy Flynn
72b3ea49d6
LibJS: Enable Temporal tests that now pass
...
These pass now that negative zero is disallowed by SignedBigInteger.
2022-02-06 15:49:54 +00:00
Linus Groh
19a2b32065
LibJS: Reject '-000000' as extended year
...
This is a normative change in the Temporal spec.
See: e60ef9e
2022-02-02 14:46:52 +00:00
Timothy Flynn
42c9c57141
LibJS+LibTimeZone: Begin handling DST when computing time zone offsets
...
This also updates some expectations in a Temporal time zone offset test
that is using a time stamp which is in DST for a few time zones.
2022-01-19 21:20:41 +00:00
Linus Groh
b9093dd0ab
LibJS: Don't validate time zone name when parsing Instant string
...
This is normative change in the Temporal spec.
See: 2a81fbc
2022-01-13 10:08:34 +01:00
Linus Groh
392f5bfebd
LibJS: Fix fraction substring range in parse_temporal_time_zone_string()
...
Two issues:
- The intended range was 9 characters starting from index 1. Since the
second argument to String::substring() is the length, 10 is
potentially reading further than the string's length (when only
providing one fraction digit), causing an assertion failure crash.
- The spec's intention to skip the decimal separator by starting at
index 1 is incorrect, no decimal separator is present in the result of
parsing TimeZoneUTCOffsetFractionalPart. I filed a spec fix for this,
see: https://github.com/tc39/proposal-temporal/pull/1999
2022-01-12 21:24:12 +01:00
Linus Groh
027e4bd439
LibJS: Fix calculation overflow in parse_temporal_time_zone_string()
...
As all variables and numeric literals in the expression have an integral
data type, it would evaluate to an int and could easily overflow as
we're multiplying seconds with 10^9.
Introduce a floating point literal into the expression to make it result
in a double.
2022-01-12 21:24:12 +01:00
Timothy Flynn
f6786881aa
LibJS: Implement the ECMA-402 definition of DefaultTimeZone
...
Simply defer to LibTimeZone to retrieve the system's current time zone.
Also update some Temporal tests to explicitly set the time zone to UTC.
2022-01-12 15:43:12 +01:00
Linus Groh
355fbcb702
LibJS: Actually implement get_iana_time_zone_offset_nanoseconds()
...
Instead of hard-coding an UTC offset of zero seconds, which worked for
the sole UTC time zone, we can now get the proper offset from the TZDB!
2022-01-11 22:17:39 +01:00