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

414 commits

Author SHA1 Message Date
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
Linus Groh
453c78215c LibJS: Implement parsing of TemporalTimeString 2021-11-20 23:10:09 +00:00
Linus Groh
b42b7d5f16 LibJS: Implement parsing of TemporalDateTimeString 2021-11-20 23:10:09 +00:00
Linus Groh
02e7de2cba LibJS: Implement parsing of TemporalDateString 2021-11-20 23:10:09 +00:00
Linus Groh
d0c29c9735 LibJS: Allow string as parameter in Temporal's round() / total()
This is a normative change in the Temporal spec.

See: 1f0c586
2021-11-19 11:06:53 +00:00
Linus Groh
ec1e1f4f12 LibJS: Disallow Temporal.Duration input values to be non-integers
This is a normative change in the Temporal spec.

See: 8c85450
2021-11-17 22:20:59 +00:00
Luke Wilde
3666d2132b LibJS: Remove fallback value for get_offset_nanoseconds_for
This is a normative change in the Temporal spec.

See: 664f02d

Note that the tests are not comprehensive.
2021-11-17 11:30:13 +00:00
Luke Wilde
ac65fb40d9 LibJS: Implement Temporal.PlainDate.prototype.since 2021-11-16 01:06:07 +00:00
Luke Wilde
ddec3bc888 LibJS: Implement Temporal.PlainDate.prototype.until 2021-11-16 01:06:07 +00:00
Luke Wilde
f6ab63993a LibJS: Implement Temporal.ZonedDateTime.prototype.round 2021-11-13 19:48:54 +00:00
Linus Groh
dbe70e7c55 LibJS: Implement Temporal.Duration.prototype.total() 2021-11-13 18:50:54 +00:00
Linus Groh
f0cd727d74 LibJS: Fix logic typo in balance_duration() hours calculation
By using milliseconds_division_result instead of seconds_division_result
here, the result for hours was off by a factor of 60.
2021-11-13 13:32:35 +00:00
Linus Groh
7f8dc395c1 LibJS: Implement Temporal.ZonedDateTime.prototype.with() 2021-11-13 00:25:40 +00:00
Luke Wilde
f65d25682c LibJS: Implement Temporal.ZonedDateTime.prototype.subtract 2021-11-12 09:24:36 +00:00