Closed Bug 1929284 Opened 1 year ago Closed 1 year ago

Update Temporal implementation to draft November 1, 2024

Categories

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

task

Tracking

()

RESOLVED FIXED
135 Branch
Tracking Status
firefox135 --- fixed

People

(Reporter: anba, Assigned: anba)

References

(Blocks 1 open bug)

Details

Attachments

(47 files)

48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
No description provided.
Severity: -- → N/A
Priority: -- → P3
  • Update spec references to match the current spec text more closely.
  • Use MOZ_TRY_VAR to reduce code duplication.
  • Add ParsedZonedDateTime to reduce the number of out-params for
    ParseTemporalZonedDateTimeString and ParseTemporalRelativeToString.
  • Also track "start-of-day" in preparation for the next part.
  • Remove precalculated date-time parameters from AddZonedDateTime and DifferenceZonedDateTimeWithRounding.
  • Rename GetPlainDateTimeFor to GetISODateTimeFor per current spec.
  • Inline GetOffsetStringFor into its single caller per current spec.

The options parameter is now (again) handled in the various ToTemporalThing
operations.

Also merge ToTemporalDuration and ToTemporalDurationRecord per latest spec.

Sync the operation names and add two new operations
NormalizeDurationWith24HourDays and NormalizeDurationWithoutTime.

NOTE: Later spec updates have renamed these operations. Later parts in this
patch stack will update the operations to their current names.

The spec now has a separate ISODateWithinLimits operation.

Spec operations have been renamed to all start with "AddDurationTo" and there
were some additional minor implementation changes.

  • Change AddTime, BalanceTime, and RoundTime to return a TimeRecord (per spec).
  • New callers to AddTime and BalanceTime require int64_t for days, so using
    int64_t for all three functions is now necessary.
  • The new TODO notes in AddDurationToYearMonth will be addressed when updating
    the Temporal Fields operations.
  • Sync step comments.
  • Reorder steps to match current proposal.
  • Add TODO notes for still missing changes.

Drive-by changes:

  • Make the MonthCodes constructor a bit more readable.
  • Change constants in monthcodes namespace to avoid a parser error in the CDT indexer.

"Temporal Fields" are now "Calendar Fields" in the spec. Multiple operations
have been simplified now that user-defined calendars have been removed. Sync
all operations which use "Calendar Fields" to match the current spec text.

We don't have to use Int128, because without user-defined time zones, it's guaranteed
that the values fit into int64_t.

Sync all operations and step references to the current draft proposal.

options are now processed before the early return.

Drive-by changes:

  • Update names for CompareTimeDuration, TimeDurationSign, and DateDurationDays.
  • Pass ZonedDateTime to AddZonedDateTime and DifferenceZonedDateTimeWithRounding
    instead of reading the individual fields in the callers.

Sync all operations and step references to the current draft proposal.

Perform the following renames:

  • PlainDate(Time) -> ISODate(Time)
  • PlainTime -> Time
  • PlainXXXWithCalendar -> PlainXXX.

Sync all operations and step references to the current draft proposal.

The spec no longer passes Temporal.Instant objects around and instead directly
uses the nanoseconds amount. Rename the Instant struct to EpochNanoseconds to
match the current spec use more closely.

The spec now also defines a Time Duration value, so it's confusing when an
internal implementation type is named TimeDuration.

Rounding operations were reordered and split into different operations. Update
everything to match the current spec text.

Sync all operations and step references to the current draft proposal.

Rename ToTemporalCalendarIdentifier to CalendarIdentifier to avoid confusion
with the spec operation ToTemporalCalendarIdentifier.

Sync all operations and step references to the current draft proposal.

Sync all operations and step references to the current draft proposal.

Sync all operations and step references to the current draft proposal.

ICU4X doesn't yet provide this operation, so we have to write our own implementation.

ICU4X doesn't yet provide a public API for this operation, so we have to write
our own implementation.

Blocks: 1912757
Pushed by andre.bargull@gmail.com: https://hg.mozilla.org/integration/autoland/rev/adaacc03dc4f Part 1: Various editorial updates. r=dminor https://hg.mozilla.org/integration/autoland/rev/b6f30453153e Part 2: Disallow rounding to increment while balancing to calendar unit. r=dminor https://hg.mozilla.org/integration/autoland/rev/ee257f72e4c3 Part 3: Sync TemporalParser. r=dminor https://hg.mozilla.org/integration/autoland/rev/93b34d6de713 Part 4: Handle "start of day" separately from "midnight". r=dminor https://hg.mozilla.org/integration/autoland/rev/63c3e38aa87a Part 5: Remove precalculated date-time parameters and sync operation names. r=dminor https://hg.mozilla.org/integration/autoland/rev/6ef814f5cfef Part 6: Sync processing of "options" in ToTemporal operations. r=dminor https://hg.mozilla.org/integration/autoland/rev/21548a9ebb44 Part 7: Sync normalize duration operations. r=dminor https://hg.mozilla.org/integration/autoland/rev/0b9705544e7b Part 8: Add ISODateWithinLimits. r=dminor https://hg.mozilla.org/integration/autoland/rev/10a3237bfe6b Part 9: Synchronise operations to add durations. r=dminor https://hg.mozilla.org/integration/autoland/rev/2c0dd60a07fe Part 10: Merge CanonicalizeUValue into IsBuiltinCalendar. r=dminor https://hg.mozilla.org/integration/autoland/rev/15302cb66051 Part 11: Sync steps in PlainYearMonth. r=dminor https://hg.mozilla.org/integration/autoland/rev/347f3afc24e7 Part 12: Add missing include guards. r=dminor https://hg.mozilla.org/integration/autoland/rev/a65d72c20c3a Part 13: Sync Calendar Fields operations. r=mgaudet https://hg.mozilla.org/integration/autoland/rev/0a8562654882 Part 14: Sync step comments for Temporal.Instant. r=mgaudet https://hg.mozilla.org/integration/autoland/rev/36a71a646110 Part 15: Remove individual AOs for each calendar field. r=mgaudet https://hg.mozilla.org/integration/autoland/rev/efb3a6becd0f Part 16: Reorder more Calendar operations. r=mgaudet https://hg.mozilla.org/integration/autoland/rev/7c84fde489b3 Part 17: More editorial changes. r=mgaudet https://hg.mozilla.org/integration/autoland/rev/e9dd7a737ebe Part 18: Sync Calendar{Date,YearMonth,MonthDay}FromFields. r=dminor https://hg.mozilla.org/integration/autoland/rev/fd8642b60cc7 Part 19: Merge operations into CalendarDateAdd and CalendarDateUntil. r=dminor https://hg.mozilla.org/integration/autoland/rev/e12cbfccea67 Part 20: Sync BalanceISODate. r=dminor
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
Pushed by andre.bargull@gmail.com: https://hg.mozilla.org/integration/autoland/rev/e9325daae0f5 Part 21: Nanoseconds difference between two consecutive days fits into int64. r=dminor https://hg.mozilla.org/integration/autoland/rev/c86264931c4e Part 22: More editorial changes. r=dminor https://hg.mozilla.org/integration/autoland/rev/45e0b5d06822 Part 23: Sync PlainTime. r=allstarschh https://hg.mozilla.org/integration/autoland/rev/4c168e3eae7e Part 24: Sync Duration.prototype.compare. r=allstarschh https://hg.mozilla.org/integration/autoland/rev/662a3d98914c Part 25: Add missing range check to PlainDateTime.prototype.toString. r=allstarschh https://hg.mozilla.org/integration/autoland/rev/3a9ba9dcd768 Part 26: Constrain day when year is present in CalendarMonthDayToISOReferenceDate. r=allstarschh https://hg.mozilla.org/integration/autoland/rev/26674a6896f7 Part 27: Add missing date-time range checks. r=allstarschh https://hg.mozilla.org/integration/autoland/rev/02748035a5d4 Part 28: Sync Temporal.Now. r=dminor https://hg.mozilla.org/integration/autoland/rev/b2bb14a8a765 Part 29: Sort CalendarField enum values. r=dminor https://hg.mozilla.org/integration/autoland/rev/ba5312b0d8ff Part 30: Rename date-time classes to match spec uses. r=dminor https://hg.mozilla.org/integration/autoland/rev/5e93026f1b64 Part 31: Sync TimeZone. r=dminor https://hg.mozilla.org/integration/autoland/rev/a547264ae9d4 Part 32: Rename Instant -> EpochNanoseconds. r=dminor https://hg.mozilla.org/integration/autoland/rev/d3f981765985 Part 33: Remove TimeDuration. r=mgaudet https://hg.mozilla.org/integration/autoland/rev/753aca5e850b Part 34: Rename NormalizedDuration -> InternalDuration and NormalizedTimeDuration -> TimeDuration. r=mgaudet https://hg.mozilla.org/integration/autoland/rev/3331f8cdae9e Part 35: Update DifferenceISODate implementation. r=mgaudet https://hg.mozilla.org/integration/autoland/rev/09da4ae15d17 Part 36: Sync Duration rounding. r=mgaudet https://hg.mozilla.org/integration/autoland/rev/8d23aba37625 Part 37: Sync Temporal.PlainDateTime. r=mgaudet https://hg.mozilla.org/integration/autoland/rev/8e190ff19827 Part 38: Replace ToTemporalCalendarIdentifier. r=dminor https://hg.mozilla.org/integration/autoland/rev/e38748470789 Part 39: Avoid repeating constants for minimum and maximum valid date. r=dminor https://hg.mozilla.org/integration/autoland/rev/a8c8e9236d34 Part 40: Sync PlainDate. r=dminor https://hg.mozilla.org/integration/autoland/rev/e5a77786ab80 Part 41: Remove unused code and avoid duplicated code for time duration to days. r=dminor https://hg.mozilla.org/integration/autoland/rev/7f9a3a237161 Part 42: Sync ZonedDateTime. r=dminor https://hg.mozilla.org/integration/autoland/rev/4f245b22d1fd Part 43: Sync Temporal.Duration. r=allstarschh https://hg.mozilla.org/integration/autoland/rev/9f26e0e34338 Part 44: Implement CalendarDateAdd for non-ISO calendars. r=allstarschh https://hg.mozilla.org/integration/autoland/rev/41c6654d35f1 Part 45: Add a workaround for an ICU4X bug. r=allstarschh https://hg.mozilla.org/integration/autoland/rev/9260b23b9b9c Part 46: Implement DifferenceCalendarDate. r=allstarschh https://hg.mozilla.org/integration/autoland/rev/db051ac54c32 Part 47: Enable now passing tests. r=allstarschh

https://hg.mozilla.org/mozilla-central/rev/e9325daae0f5
https://hg.mozilla.org/mozilla-central/rev/c86264931c4e
https://hg.mozilla.org/mozilla-central/rev/45e0b5d06822
https://hg.mozilla.org/mozilla-central/rev/4c168e3eae7e
https://hg.mozilla.org/mozilla-central/rev/662a3d98914c
https://hg.mozilla.org/mozilla-central/rev/3a9ba9dcd768
https://hg.mozilla.org/mozilla-central/rev/26674a6896f7
https://hg.mozilla.org/mozilla-central/rev/02748035a5d4
https://hg.mozilla.org/mozilla-central/rev/b2bb14a8a765
https://hg.mozilla.org/mozilla-central/rev/ba5312b0d8ff
https://hg.mozilla.org/mozilla-central/rev/5e93026f1b64
https://hg.mozilla.org/mozilla-central/rev/a547264ae9d4
https://hg.mozilla.org/mozilla-central/rev/d3f981765985
https://hg.mozilla.org/mozilla-central/rev/753aca5e850b
https://hg.mozilla.org/mozilla-central/rev/3331f8cdae9e
https://hg.mozilla.org/mozilla-central/rev/09da4ae15d17
https://hg.mozilla.org/mozilla-central/rev/8d23aba37625
https://hg.mozilla.org/mozilla-central/rev/8e190ff19827
https://hg.mozilla.org/mozilla-central/rev/e38748470789
https://hg.mozilla.org/mozilla-central/rev/a8c8e9236d34
https://hg.mozilla.org/mozilla-central/rev/e5a77786ab80
https://hg.mozilla.org/mozilla-central/rev/7f9a3a237161
https://hg.mozilla.org/mozilla-central/rev/4f245b22d1fd
https://hg.mozilla.org/mozilla-central/rev/9f26e0e34338
https://hg.mozilla.org/mozilla-central/rev/41c6654d35f1
https://hg.mozilla.org/mozilla-central/rev/9260b23b9b9c
https://hg.mozilla.org/mozilla-central/rev/db051ac54c32

Status: REOPENED → RESOLVED
Closed: 1 year ago1 year ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: