-
Notifications
You must be signed in to change notification settings - Fork 54
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Location with the name "Etc/UTC" doesn't exist #176
Comments
Okay so this comes up a lot, so thought I would take the time to give a full answer here. Maybe someone can add this to the docs as away of explanation. It took me a while to figure this all out. The problem is that this package doesn't support many timezone abbreviations such as The problem is that timezones are really, really complicated, and to deal with them you have to understand a bit of this complexity. I'm not an expert, but I think the problem is that
Most of the time, the timezone we get back from
And if we look at the docs for
"may vary with implementation" basically means we have to deal with all kinds of garbage results, eg from old devices, SDKs, emulators etc. So, unfortunately this is just a problem we have to deal with ourselves. The docs state this on the front page:
Ideally you should only pass unambiguous abbreviations, or full timezone identifiers. For example see the list in Wikipedia: the full timezone identifier is in the 'TZ identifier' column. Notice how the ETC abbreviations don't have proper timezone identifiers. As a workaround, we have to manually assign these ambiguous timezones to a best guess. For example:
Alternatively you could try setting the timezone on the emulator, or trying a different emulator image which returns a valid timezone. Also note the use of See this old closed issue for more discussion. |
Thank you very much @jamesncl for such a thorough explanation. Looks like I unknowingly stepped into an uncanny valley of ambiguity :D Should I close the issue or leave it open for future wanderers? And again, I really appreciate your comment. Thank you! |
Stumbled across this issue here with my own app. Using the all database does indeed fix it, but the page on pub.dev also says:
I would assume then that Etc/UTC is supported. |
That's how I initialize timezone data in my app:
When I run this code on Android Lollipop emulator (API level 21), the following exception is thrown:
I'd be grateful for any support or even an idea how this could be mitigated.
The text was updated successfully, but these errors were encountered: