srawlins / timezone

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

Location with the name "Asia/Chongqing" doesn't exist. #75

Closed lanistor closed 2 years ago

lanistor commented 3 years ago

Get location name by flutter_native_timezone:

currentTimeZone = await FlutterNativeTimezone.getLocalTimezone();
tz.initializeTimeZones();
var loc = tz.getLocation(currentTimeZone);
tz.setLocalLocation(loc);

Users report the error (iPhone device), i get it's because the tz.timeZoneDatabase.locations doesn't contains Asia/Chongqing the got by flutter_native_timezone.

What should i do to resolve it? I think there's a way: get nearest location of Asia/Chongqing, by for other locations, how to automaticlly map them?

faisalmushtaq007 commented 3 years ago

Unhandled Exception: Location with the name "Asia/Calcutta" doesn't exist any solutions????

DominicOrga commented 3 years ago

I was able to use deprecated locations by importing 'package:timezone/data/latest_all.dart' instead of 'package:timezone/data/latest.dart'.

srawlins commented 2 years ago

Apologies for the late response. Both Asia/Chongqing and Asia/Calcutta are available in latest_all.

MrCsabaToth commented 1 year ago

How do you call tz.getLocation( while 'package:timezone/data/latest_all.dart' only provides one function initializeTimeZones?