`Temporal.ZonedDateTime.p.getTimeZoneTransition` returns an incorrect result
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)
@nekevss I'm transferring this issue to temporal_rs
I'll try to take a look at it as soon as possible.
If it happened in the playground then it's definitely a problem with the resolution logic for the data from jiff_tzdb. I'll try to look at it, and maybe it would be a good idea while in there to work on the logic for the compiled data in timezone_provider
Note that for "returns the same offset", a lot of timezone database models have "fake" transitions that do not actually transition, which the spec wants us to ignore. This is correctly implemented in the zoneinfo64 provider, and maybe the tzif provider (I recall trying to implement it, at least).