Open Bug 1912511 Opened 7 months ago Updated 10 days ago

Ship Temporal

Categories

(Core :: JavaScript: Standard Library, task, P3)

task

Tracking

()

People

(Reporter: dminor, Assigned: dminor)

References

(Depends on 1 open bug, Blocks 1 open bug)

Details

(Keywords: dev-doc-needed)

The temporal champions are asking implementers to consider shipping Temporal. We should at least have a bug on file to do this.

Depends on: 1912757
Depends on: 1912782
Severity: -- → N/A
Priority: -- → P3

This can only be complete after this bug is actually fixed and Temporal landed.

Hi Anba, other than fuzzing, do you know of any bugs or spec issues that would block us from being able to ship Temporal?

Flags: needinfo?(andrebargull)

There are two open normative PRs, but both are for edge-cases and therefore shouldn't be blockers:

We should decide if we want to implement locale-sensitive Duration.prototype.toLocaleString, even though this isn't currently spec'ed. Users may expect this to work, because the polyfill already implements it:

We also likely need to add caches for time zones and calendars at some point. Possibly also cache computed calendar fields, so that for example accessing plainDate.year doesn't lead to repeatedly creating new ICU4X date and calendar objects. This probably also falls in the nice-to-have bucket, but isn't a release blocker:

I think more important are better error messages, because Temporal adds new concepts and APIs to JavaScript, which are possibly unfamiliar to developers. And cryptic error messages could prevent adaption of Temporal. I think it wouldn't hurt if the existing error messages are checked (by a native speaker) to ensure the language is correct and understandable.

Flags: needinfo?(andrebargull)
Depends on: 1839676
Assignee: nobody → dminor
Depends on: 1946823

I forgot to mention ICU4X issues.

  1. Dates too far into the past or future aren't yet supported:
  1. Islamic to ISO8601 calendar conversion bug:

Example: Temporal.PlainDate.from({year: 1390, monthCode: "M01", day: 30, calendar: "islamic"}).day returns 0.

  1. Different start of epoch for Islamic calendar:

That leads to a one day difference when Intl.DateTimeFormat, which uses ICU4C instead of ICU4X.

js> d = Temporal.Now.plainDateISO().withCalendar("islamic")
({})
js> d.month + "-" + d.day                                   
"8-14"
js> d.toLocaleString("en", {calendar:"islamic"})            
"8/15/1446 AH"

In addition to that one-day difference, ICU4X is also using different algorithms to compute dates in the Islamic and Chinese calendars. That leads to returning different results depending on whether ICU4X or ICU4C code is called:

js> d = new Temporal.PlainDate(2027, 2, 6, "chinese")
({})
js> d.month + "-" + d.day
"1-1"
js> d.toLocaleString("en", {calendar:"chinese"})
"12/30/2026"
You need to log in before you can comment on or make changes to this bug.