boa icon indicating copy to clipboard operation
boa copied to clipboard

Tracking issue for the `Temporal` builtin

Open Razican opened this issue 3 years ago • 3 comments

Tracking for the Temporal built-in implementation

  • [x] First prototype (#3277)
  • [x] Migrate Temporal to independent boa_temporal crate (#3461)
  • [ ] Complete Temporal.Duration (#4070)
  • [ ] Complete Temporal.PlainDate (#4071)
  • [ ] Complete Temporal.Instant (#4074)
  • [ ] Complete Temporal.PlainDateTime (#4072)
  • [ ] Complete Temporal.PlainYearMonth (#4077)
  • [ ] Complete Temporal.PlainMonthDay (#4076)
  • [ ] Implement Temporal.PlainTime methods and operations (#4073)
  • [x] ~~Implement Temporal.TimeZone methods and operations~~ (Removed from the Temporal Proposal Mid 2024)
  • [ ] Implement Temporal.ZonedDateTime methods and operations (#4075)
  • [ ] Complete Temporal.Now (dependent on Temporal.Instant, Temporal.DateTime and Temporal.ZonedDateTime)

ECMASCript feature The new Temporal API has been introduced to improve date handling in JavaScript, and we should add it to Boa to be up to date with the current ECMAScript standard. Tests have been added to the official ECMAScript Test Suite (test262), so we need to pass these tests to get full coverage.

The current proposal (Stage 3) specification can be found here: https://tc39.es/proposal-temporal/

In order to implement this new proposal, you can follow the example of other builtin objects, and feel free to ask for help: https://github.com/boa-dev/boa/tree/main/boa/src/builtins

Example code

This code should now work and give the expected result:

// exact time since the Unix epoch on 1 Janary, 1970 UTC
Temporal.now.instant();
Temporal.now.instant().epochSeconds;
Temporal.now.instant().epochMilliseconds;

// current time zone
Temporal.now.timeZone();

// time in current location, e.g.
// 2021-09-18T04:17:48.435068431-04:00[America/New_York]
Temporal.now.zonedDateTimeISO();

// time in another time zone, e.g.
// 2021-09-18T09:17:48.438068435+01:00[Europe/London]
Temporal.now.zonedDateTimeISO('Europe/London');

Razican avatar Jan 29 '22 10:01 Razican

https://github.com/boa-dev/boa/issues/1180 Is related to this

jasonwilliams avatar Jan 29 '22 10:01 jasonwilliams

I'd like to attempt to implement this.

lupd avatar Apr 15 '22 01:04 lupd

Great. I’ve assigned you @lupd

jasonwilliams avatar Apr 15 '22 08:04 jasonwilliams