1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-16 02:04:58 +00:00
Commit graph

377 commits

Author SHA1 Message Date
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
Linus Groh
d527eb62da LibJS: Support non-UTC time zones in Temporal :^)
We can now recognize & normalize all time zones from the IANA time zone
database and not just 'UTC', which makes the LibJS Temporal
implementation a lot more useful! Thanks to the newly added LibTimeZone,
this was incredibly easy to implement :^)

This already includes these recent editorial changes in the Temporal
spec: 27bffe1
2022-01-11 22:17:39 +01:00
Linus Groh
f1276144ba LibJS: Check if input was exhausted after parsing UTC offset fraction
Previously parse_time_zone_numeric_utc_offset_syntax() would return true
to indicate success when parsing a string with an invalid number of
digits in the fractional seconds part (e.g. 23:59:59.9999999999).
We need to check if the lexer has any characters remaining, and return
false if that's the case.
2022-01-11 21:16:33 +01:00
Linus Groh
de07312cc7 LibJS/Tests: Add Temporal.TimeZone() tests for numeric UTC offset
This works now, let's test it :^)
2022-01-11 21:16:33 +01:00
Linus Groh
3bd7f5b89e LibJS: Fully parse the TimeZoneIANAName production
Currently does nothing as we'll declare everything other than UTC as
invalid, but it's a first step towards supporting named time zones :^)
2022-01-06 22:40:09 +01:00
Linus Groh
d42336312c LibJS: Include time zone name in TemporalInvalidTimeZoneName error 2022-01-06 21:49:50 +01:00
davidot
c0a3b1467c LibJS: Fix the Now.plainDateTime in case they go over a year boundary
Since years don't have a constant amount of seconds because they can be
leap years no constant will work in all cases. We now test a timezone in
both the positive and negative direction and check that at least one
worked. Assuming years are at least 2 days long this will always pass
at least one test.
2021-12-31 12:26:26 +01:00
Linus Groh
3ab1c52e2b LibJS: Require 'T' prefix for ambiguous time-only strings
This is a normative change in the Temporal spec.

See: 514ede3
2021-12-24 00:07:52 +01:00
Linus Groh
c56e5139f5 LibJS: Fix modulo in get_iso_parts_from_epoch() for negative epoch ns
This now matches the spec change from reminder() to modulo which was
done here: bdf60f5
2021-12-22 11:27:31 +01:00
Luke Wilde
cf5f08b317 LibJS: Only allow TimeZone this value in TimeZone#getPlainDateTimeFor
This is a normative change in the Temporal spec.

See: 2644fc6
2021-12-19 00:13:01 +00:00
Luke Wilde
7729598b5b LibJS: Only allow TimeZone this value in Temporal.TimeZone#toJSON
This is a normative change in the Temporal spec.

See: 2644fc6
2021-12-19 00:13:01 +00:00
Luke Wilde
6c8c34ed6c LibJS: Only allow TimeZone this value in Temporal.TimeZone#id
This is a normative change in the Temporal spec.

See: 2644fc6
2021-12-19 00:13:01 +00:00
Luke Wilde
803e96f0c5 LibJS: Only allow Calendar this value in Temporal.Calendar#toJSON
This is a normative change in the Temporal spec.

See: 2644fc6
2021-12-19 00:13:01 +00:00
Linus Groh
247d2f7cc4 LibJS: Only allow Calendar this value in Temporal.Calendar.prototype.id
This is a normative change in the Temporal spec.

See: 2644fc6
2021-12-18 22:32:39 +00:00
Linus Groh
3214e35535 LibJS/Tests: Remove outdated FIXME 2021-12-17 23:22:30 +00:00
Luke Wilde
2cea4ad508 LibJS: Implement Temporal.Duration.prototype.subtract 2021-11-29 22:56:35 +00:00
Luke Wilde
ac8c3919cb LibJS: Implement Temporal.Duration.prototype.add 2021-11-29 22:56:35 +00:00
Luke Wilde
acf8729a81 LibJS: Implement Temporal.Duration.prototype.round 2021-11-29 22:56:35 +00:00
Linus Groh
f7ba81ac52 LibJS: Implement parsing of TemporalDurationString 2021-11-28 10:32:28 +00:00
Linus Groh
8f99c05f97 LibJS: Implement Temporal.PlainYearMonth.prototype.since() 2021-11-27 19:11:31 +00:00
Linus Groh
bdd2c357fd LibJS: Implement Temporal.PlainYearMonth.prototype.until() 2021-11-27 19:11:31 +00:00
Linus Groh
6f2e0b3355 LibJS: Implement Temporal.PlainYearMonth.prototype.subtract() 2021-11-27 17:48:04 +00:00
Linus Groh
acbcd64cdc LibJS: Implement Temporal.PlainYearMonth.prototype.add() 2021-11-27 17:48:04 +00:00
Linus Groh
de69f5dbf4 LibJS: Implement Temporal.ZonedDateTime.prototype.since() 2021-11-24 17:53:00 +00:00
Linus Groh
7a2eeae8c6 LibJS: Implement Temporal.ZonedDateTime.prototype.until() 2021-11-24 17:53:00 +00:00
Linus Groh
78724fdd33 LibJS: Don't accept UTC designators in strings for plain Temporal types
This is a normative change in the Temporal spec.

See: cd2dc7d
2021-11-24 08:56:03 +00:00
Linus Groh
836ce8ee5d LibJS: Fix parse ErrorType used in parse_temporal_date_string()
TemporalInvalidDateString, not TemporalInvalidDateTimeString.
2021-11-24 08:38:50 +00:00
Linus Groh
0619c34703 LibJS: Implement Temporal.PlainDateTime.prototype.since() 2021-11-21 20:04:19 +00:00
Linus Groh
803eddbb62 LibJS: Implement Temporal.PlainDateTime.prototype.until() 2021-11-21 20:04:19 +00:00
Linus Groh
aed444253c LibJS: Implement Temporal.PlainTime.prototype.since() 2021-11-21 20:04:19 +00:00
Linus Groh
2ac1774fd3 LibJS: Implement Temporal.PlainTime.prototype.until() 2021-11-21 20:04:19 +00:00
Linus Groh
783222f87a LibJS: Implement parsing of TemporalInstantString 2021-11-20 23:10:09 +00:00
Linus Groh
79a18b058f LibJS: Implement parsing of TemporalCalendarString 2021-11-20 23:10:09 +00:00
Linus Groh
1583c7257c LibJS: Implement parsing of TemporalRelativeToString 2021-11-20 23:10:09 +00:00
Linus Groh
98b876ad3f LibJS: Implement parsing of TemporalZonedDateTimeString 2021-11-20 23:10:09 +00:00
Linus Groh
3b1de431cc LibJS: Implement parsing of TemporalYearMonthString 2021-11-20 23:10:09 +00:00
Linus Groh
3ddab2f4fe LibJS: Implement parsing of TemporalMonthDayString 2021-11-20 23:10:09 +00:00