Commit graph

1175 commits

Author SHA1 Message Date
Timothy Flynn
18f95434bc LibJS: Implement the Temporal.Duration relative-to ZonedDateTime options 2024-11-26 11:00:56 +01:00
Timothy Flynn
3e6133cc09 LibJS: Handle ZonedDateTime in the various Temporal factories 2024-11-26 11:00:56 +01:00
Timothy Flynn
8c73cae2b8 LibJS: Implement the Temporal.ZonedDateTime constructor
And the simple Temporal.ZonedDateTime.prototype getters, so that the
constructed Temporal.ZonedDateTime may actually be validated.
2024-11-26 11:00:56 +01:00
Timothy Flynn
8ab765a3eb LibJS: Invoke CalendarDateToISO recursively correctly
Copy-paste mistake that becomes apparent in Temporal.ZonedDateTime
tests.
2024-11-26 11:00:56 +01:00
Pavel Shliak
4ae3a0dcba LibJS: Make a __JS_ENUMERATE comment more informative 2024-11-25 13:17:03 -07:00
Timothy Flynn
f2c19f96f8 LibJS: Implement Temporal.Now 2024-11-25 13:32:58 +01:00
Timothy Flynn
f1c3e3d71a LibJS: Implement Temporal.Instant.prototype.round 2024-11-25 13:32:58 +01:00
Timothy Flynn
477f00aced LibJS: Implement Temporal.Instant.prototype.until/since 2024-11-25 13:32:58 +01:00
Timothy Flynn
1d67f28e72 LibJS: Implement Temporal.Instant.prototype.add/subtract/equals 2024-11-25 13:32:58 +01:00
Timothy Flynn
615ad70030 LibJS: Implement stringification Temporal.Instant prototypes 2024-11-25 13:32:58 +01:00
Timothy Flynn
90820873a2 LibJS: Implement the Temporal.Instant constructor
And the simple Temporal.Instant.prototype getters, so that the
constructed Temporal.Instant may actually be validated.
2024-11-25 13:32:58 +01:00
Timothy Flynn
1675f40e29 LibJS: Return a GC::Ref from the NumberToBigInt AO
All callers currently handle this without needing any further changes.
2024-11-25 13:32:58 +01:00
Timothy Flynn
82b540e501 LibJS: Implement Temporal.PlainDate.prototype.toPlainDateTime 2024-11-24 11:43:59 +01:00
Timothy Flynn
d22ea4db4c LibJS: Implement Temporal.PlainDateTime.prototype.valueOf 2024-11-24 11:43:59 +01:00
Timothy Flynn
649328fed2 LibJS: Implement Temporal.PlainDateTime.prototype.toPlainDate/Time 2024-11-24 11:43:59 +01:00
Timothy Flynn
990daaf63a LibJS: Implement Temporal.PlainDateTime.prototype.with* methods
Includes with, withCalendar, and withPlainTime.
2024-11-24 11:43:59 +01:00
Timothy Flynn
e3082b5bed LibJS: Implement Temporal.PlainDateTime.prototype.round 2024-11-24 11:43:59 +01:00
Timothy Flynn
906d951104 LibJS: Implement Temporal.PlainDateTime.prototype.since/until 2024-11-24 11:43:59 +01:00
Timothy Flynn
85ffacacde LibJS: Implement Temporal.PlainDateTime.prototype.add/subtract/equals 2024-11-24 11:43:59 +01:00
Timothy Flynn
d314fcce7a LibJS: Implement stringification Temporal.PlainDateTime prototypes 2024-11-24 11:43:59 +01:00
Timothy Flynn
1a80161011 LibJS: Fix Temporal.PlainMonthDay.prototype.calendarId references
Small mistake porting old Temporal tests to the new spec. This getter
was `.calendar` in the old Temporal spec.
2024-11-24 11:43:59 +01:00
Timothy Flynn
029b6ad1a8 LibJS: Implement the Temporal.PlainDateTime constructor
And the simple Temporal.PlainDateTime.prototype getters, so that the
constructed Temporal.PlainDateTime may actually be validated.
2024-11-24 11:43:59 +01:00
Timothy Flynn
e37c9eaeff LibJS: Implement Temporal.PlainTime.prototype.valueOf 2024-11-23 19:35:36 -05:00
Timothy Flynn
d639e9429f LibJS: Implement Temporal.PlainTime.prototype.round/equals 2024-11-23 19:35:36 -05:00
Timothy Flynn
a0df194528 LibJS: Implement Temporal.PlainTime.prototype.with 2024-11-23 19:35:36 -05:00
Timothy Flynn
85eef698b9 LibJS: Implement Temporal.PlainTime.prototype.since/until 2024-11-23 19:35:36 -05:00
Timothy Flynn
1c22011ed6 LibJS: Implement Temporal.PlainTime.prototype.add/subtract 2024-11-23 19:35:36 -05:00
Timothy Flynn
ab3c825fa8 LibJS: Implement stringification Temporal.PlainTime prototypes 2024-11-23 19:35:36 -05:00
Timothy Flynn
66365fef57 LibJS: Implement the Temporal.PlainTime constructor
And the simple Temporal.PlainTime.prototype getters, so that the
constructed Temporal.PlainTime may actually be validated.
2024-11-23 19:35:36 -05:00
Timothy Flynn
971f794127 LibJS: Add and use a BigInt-aware override of BalanceTime
With Temporal.PlainTime, we will need precise results for extremely
large values.
2024-11-23 19:35:36 -05:00
Timothy Flynn
7f3de3be9c LibJS: Capture sub-second nanoseconds as a u64 in FormatTimeString
This is not a plain nanosecond value (which has a range of [0, 999]).
Rather, it is all of the sub-second components added together.
2024-11-23 19:35:36 -05:00
Timothy Flynn
0b59971ef9 LibJS: Reject ambiguous annotated time strings
This missing rejection will be caught by an upcoming Temporal.PlainTime
test.
2024-11-23 19:35:36 -05:00
Timothy Flynn
c83a3db542 LibJS: Handle Temporal.PlainDate in dynamic calendar operations 2024-11-23 19:35:36 -05:00
Timothy Flynn
d0149d8fc0 LibJS: Begin implementing the relativeTo option of Duration.total 2024-11-23 14:46:00 +01:00
Timothy Flynn
70ad66d3c0 LibJS: Begin implementing the relativeTo option of Duration.round 2024-11-23 14:46:00 +01:00
Timothy Flynn
0befd52725 LibJS: Begin implementing the relativeTo option of Duration.compare 2024-11-23 14:46:00 +01:00
Timothy Flynn
06593b1894 LibJS: Implement most of GetTemporalRelativeToOption
Now that we have the Temporal.PlainDate object, we can flesh out this AO
for such relative-to objects.
2024-11-23 14:46:00 +01:00
Timothy Flynn
521638642f LibJS: Capture CalendarFields by reference in Calendar*FromFields AOs
These fields are modified by an invocation to CalendarResolveFields. All
callers currently don't care about these modifications, so they move the
CalendarFields struct into the AO. But it turns out that at least one AO
will care (InterpretTemporalDateTimeFields), thus we will need to take
by reference here.
2024-11-23 14:46:00 +01:00
Timothy Flynn
021a5f4ded LibJS: Move ISO-related structures to their own file
Currently, AbstractOperations.h needs to include Time.h for the Time
structure. Soon, Time.h will need to include AbstractOperations.h for
structures defined there. To avoid a circular include, let's put the
ISO types into their own file, so that AO.h does not need to include
any JS type header.
2024-11-23 14:46:00 +01:00
Timothy Flynn
46998e922a LibJS: Implement Temporal.PlainMonthDay/YearMonth.prototype.toPlainDate 2024-11-23 14:46:00 +01:00
Timothy Flynn
06ef32818e LibJS: Implement Temporal.PlainDate.prototype.valueOf 2024-11-23 14:46:00 +01:00
Timothy Flynn
f8b593a7df LibJS: Implement Temporal.PlainDate.prototype.toPlainMonthDay/YearMonth 2024-11-23 14:46:00 +01:00
Timothy Flynn
3aa4cdd314 LibJS: Implement Temporal.PlainDate.prototype.until/since 2024-11-23 14:46:00 +01:00
Timothy Flynn
abc6b679c3 LibJS: Check both the quotient and remainder for rounding negativity
Our BigInt implementation can store the negativity of the division
result in either the quotient or the remainder. This is exposed by an
upcoming prototype, which will reach this division with:

    -432000000000000 / 86400000000000000000000

Which has the BigInt division result:

    quotient = 0
    remainder = -432000000000000

(Our old Temporal implementation also had this bug).
2024-11-23 14:46:00 +01:00
Timothy Flynn
b319d45566 LibJS: Optimize the CalendarDateUntil AO for large year differences
For example, consider the following operation:

    const instance = new Temporal.PlainDate(2000, 5, 2);
    instance.until("-271821-04-19");

The spec would have us enter a loop to compute the difference between
these dates by incrementing an intermediate date one day at a time.
Instead, we can do some math to skip ahead much closer to the desired
date.
2024-11-23 14:46:00 +01:00
Timothy Flynn
f280a96e35 LibJS: Implement Temporal.PlainDate.prototype.with/withCalendar 2024-11-23 14:46:00 +01:00
Timothy Flynn
c2ead84bd9 LibJS: Implement Temporal.PlainDate.prototype.add/subtract/equals 2024-11-23 14:46:00 +01:00
Timothy Flynn
9fbb5a57fa LibJS: Implement stringification Temporal.PlainDate prototypes 2024-11-23 14:46:00 +01:00
Timothy Flynn
a0c55f76e7 LibJS: Implement the Temporal.PlainDate constructor
And the simple Temporal.PlainDate.prototype getters, so that the
constructed Temporal.PlainDate may actually be validated.
2024-11-23 14:46:00 +01:00
Timothy Flynn
b64ccb95ec LibJS: Implement Temporal.PlainYearMonth.prototype.valueOf 2024-11-22 19:55:24 +01:00