Skip to content

Temporal.ZonedDateTime.p.getTimeZoneTransition returns an incorrect result #602

@fabon-f

Description

@fabon-f

Describe the bug

Temporal.ZonedDateTime.p.getTimeZoneTransition should return future time when a time zone offset changes, but currently boa doesn't do for few cases.

To Reproduce
Steps to reproduce the issue, or JavaScript code that causes this failure.

const errors = {
  'same time': [],
  'past time': [],
  'same offset': [],
};
const edgeCases = [
  // `getTimeZoneTransition` returns ZonedDateTime with same offset
  "2023-03-25T23:00:00-02:00[America/Godthab]",
  "2015-03-08T03:00:00-04:00[America/Grand_Turk]",
  "2006-04-02T03:00:00-05:00[America/Resolute]",
  "2023-10-29T00:00:00-01:00[America/Scoresbysund]",
  "1996-01-01T02:00:00+01:00[Europe/Lisbon]",
  // `getTimeZoneTransition('next')` returns same or past time
  "2011-03-13T01:01:00-03:00[America/Goose_Bay]",
  "2011-03-13T02:59:59-03:00[America/Goose_Bay]",
  "2011-03-13T01:01:00-02:30[America/St_Johns]",
  "2007-03-11T03:00:00-05:00[America/Indiana/Petersburg]",
  "2007-11-04T00:59:59-05:00[America/Indiana/Petersburg]",
  "2007-03-11T03:00:00-05:00[America/Indiana/Vincennes]",
  "2010-03-14T03:00:00-06:00[America/North_Dakota/Beulah]",
  "2022-03-13T03:00:00-06:00[America/Ojinaga]",
  "2009-10-04T03:00:00+11:00[Antarctica/Macquarie]",
  "1998-03-29T01:00:00+03:00[Asia/Nicosia]",
  "1996-10-26T23:00:00+02:00[Europe/Bucharest]",
  "1996-10-26T23:00:00+02:00[Europe/Chisinau]",
  "1996-03-31T03:00:00+03:00[Europe/Kiev]",
  "1996-10-26T23:00:00+02:00[Europe/Sofia]",
  "1999-03-28T03:00:00+02:00[Europe/Vilnius]",
  "2015-10-04T01:30:00+11:00[Pacific/Norfolk]",
];
for (const s of edgeCases) {
  const zdt = Temporal.ZonedDateTime.from(s);
  const transition = zdt.getTimeZoneTransition("next");
  if (Temporal.ZonedDateTime.compare(transition, zdt) === 0) {
    errors['same time'].push(s);
  } else if (Temporal.ZonedDateTime.compare(transition, zdt) === -1) {
    errors['past time'].push(s);
  } else if (transition.offsetNanoseconds === zdt.offsetNanoseconds) {
    errors['same offset'].push(s);
  }
}
errors // { 'same time': Array(14), 'past time': Array(2), 'same offset': Array(5) }

Expected behavior
Explain what you expected to happen, and what is happening instead.

errors should be empty ({ 'same time': [], 'past time': [], 'same offset': [] })

spec: https://tc39.es/proposal-temporal/#sec-temporal-getnamedtimezonenexttransition

Build environment (please complete the following information):

official playground (https://boajs.dev/playground)

Additional context
Add any other context about the problem here.

issue on Chromium: https://issues.chromium.org/issues/443776749 but it's fixed now on latest Chrome Canary. I guess https://chromium-review.googlesource.com/c/v8/v8/+/6933690 fixed this, so perhaps only specific time zone providers are affected (not confirmed though)

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugSomething isn't working

    Type

    Projects

    Status

    No status

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions