srawlins / timezone

Time zone database and time zone aware DateTime object for Dart.
BSD 2-Clause "Simplified" License
101 stars 52 forks source link

Location with the name "CDT" doesn't exist - Issues with daylight saying times zones? #192

Open JonasJW opened 2 months ago

JonasJW commented 2 months ago

In my production app I get the exception Location with the name "CDT" doesn't exist. I also gotten exceptions for Same for EDT and PST. Also I have gotten exceptions for Location with the name "-03" doesn't exist.

This is my code:

final currentTimeZone = DateTime.now().timeZoneName;
tz.Location location = tz.getLocation(currentTimeZone);
tz.TZDateTime tzDate = tz.TZDateTime.from(date, location);

I'm omporting 'package:timezone/data/latest_all.dart' as tz; and 'package:timezone/timezone.dart' as tz;

CDT and PST seem to be daylight saving timezones.

Is there any recommended way on how to handle these cases?

PadreMontoya commented 1 month ago

Same issue for me.