[Bug] Daylight savings starting two hours late
AndreHaueisen opened this issue · 0 comments
AndreHaueisen commented
In 2023, the US daylight savings start on March 12th at 2 a.m.
Observe the time zone abbreviation in the video. It changes to CDT at 5 a.m. instead of 3 a.m. (since 2 a.m. essentially doesn't exist for the 12th).
Simulator.Screen.Recording.-.iPhone.14.Pro.Max.-.2023-03-03.at.08.45.10.mp4
This is the code I'm using to get the abbreviation
static String? _getTimeZoneAbbreviation({
required DateTime dateTime,
required String? locationName,
}) {
if (locationName == null) return null;
final location = tz.getLocation(locationName);
final date = tz.TZDateTime.from(dateTime, location);
return date.timeZone.abbreviation;
}