srawlins / timezone

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

getLocation() not working correctly #112

Closed spacekestrel closed 1 year ago

spacekestrel commented 3 years ago

If i use set location with value format as Etc/GMT like this:

tsetLocalLocation(getLocation('Etc/GMT-8'));
final TZDateTime tzDateTimeNow = TZDateTime.now(local);

then, by trying to acess timezome offset like this

tzDateTimeNow.timeZoneOffset.inHours

It shows value of 8, instead of -8. In other words, there is no negative numbers. But if i use location like, for ex. Canada/Atlantic - it gives desired -8 hours.

robertbastian commented 2 years ago

The Etc/GMT-8 time zone has an offset of +8. See https://unix.stackexchange.com/questions/104088/why-does-tz-utc-8-produce-dates-that-are-utc8