Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] Incorrect DST transition #164

Closed
Pante opened this issue Apr 13, 2023 · 0 comments · Fixed by #166
Closed

[Bug] Incorrect DST transition #164

Pante opened this issue Apr 13, 2023 · 0 comments · Fixed by #166

Comments

@Pante
Copy link

Pante commented Apr 13, 2023

The following code snippet on master:

import 'package:timezone/data/latest.dart' as tz;

void main() {
  tz.initializeTimeZones();
  
  final location = getLocation('America/Detroit');
  final datetime = TZDateTime(location, 2023, 3, 12, 2);
  
  print('local: ${datetime.toIso8601String()}');
  print(datetime.millisecondsSinceEpoch);
}

Produces the following:

local: 2022-03-13T01:00:00.000-0500
1647151200000

This is incorrect since the time should 3am instead of 1am due to DST, https://www.timeanddate.com/time/change/usa/detroit?year=2023.

From a brief look it's probably related to how the timezone is derived in https://github.com/srawlins/timezone/blob/master/lib/src/date_time.dart#L22.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant