-
Notifications
You must be signed in to change notification settings - Fork 173
Closed
Labels
Milestone
Description
Found a case that breaks the invariant of comparing durations as equal relative to a ZonedDateTime:
// Note: 2020-11-01 is a 25-hour day in America/Vancouver time zone
relativeTo = Temporal.ZonedDateTime.from('2019-11-01T00:00-07:00[America/Vancouver]');
duration1 = Temporal.Duration.from({ years: 1, days: 1 })
duration2 = Temporal.Duration.from({ years: 1, hours: 25 })
relativeTo.add(duration1) // => 2020-11-02T00:00:00-08:00[America/Vancouver]
relativeTo.add(duration2) // => 2020-11-02T00:00:00-08:00[America/Vancouver]
// (therefore, the durations are equal relative to 'relativeTo')
Temporal.Duration.compare(duration1, duration2, { relativeTo }) // => -1; wrong, expected 0
Temporal.Duration.compare(duration1, { years: 1, hours: 24 }, { relativeTo }) // => 0; also wrongReactions are currently unavailable