Dana-Ferguson / time_machine

A date and time API for Dart
https://pub.dartlang.org/packages/time_machine/
Apache License 2.0
125 stars 37 forks source link

Time zone US/Eastern is unknown to source TZDB: 2018 #24

Open hemanthStack opened 4 years ago

hemanthStack commented 4 years ago

Hi, I found this library today for my requirement I have to convert entire app to timezone time example US/Eastern When I tried it says not found can help me with this error

hemanthStack commented 4 years ago

How to update Timezone DB

rodion-m commented 4 years ago

Perhaps this will help: https://nodatime.org/1.2.x/userguide/tzdb

kuhnroyal commented 3 years ago

Looking at the https://pub.dev/packages/timezone package. They explicitly add the old US timezone names:

default (doesn't contain deprecated and historical zones with some exceptions like US/Eastern). 361kb

This seems smart since iOS is still sometimes reporting the old timezone names which can not be found in time_machine. I am getting error directly from the Apple Review because US/Pacific is not found.

I have arrived at the conclusion, that I need the timezone package to translate the old US timezones or hardcode them in order to use the time_machine package. But really the legacy US timezone names need to be included time_machine.

kuhnroyal commented 3 years ago

Using this atm:

      TimeMachine.initialize(<dynamic, dynamic>{
        'rootBundle': rootBundle,
        // Manually map legacy timezones reported by iOS to official IANA names
        'timeZone': (await FlutterNativeTimezone.getLocalTimezone())
            .replaceAll('GMT', 'UTC')
            .replaceAll('US/Alaska', 'America/Anchorage')
            .replaceAll('US/Arizona', 'America/Phoenix')
            .replaceAll('US/Central', 'America/Chicago')
            .replaceAll('US/Eastern', 'America/New_York')
            .replaceAll('US/Hawaii', 'Pacific/Honolulu')
            .replaceAll('US/Mountain', 'America/Denver')
            .replaceAll('US/Pacific', 'America/Los_Angeles'),
      }),