Skip to content
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

China is a single timezone #3

Closed
jace opened this issue Nov 8, 2012 · 9 comments
Closed

China is a single timezone #3

jace opened this issue Nov 8, 2012 · 9 comments

Comments

@jace
Copy link

jace commented Nov 8, 2012

The imagemap at timezonepicker.com shows China as four zones. However, China is a single timezone. India and Nepal are highlighted together, but India is +0530 while Nepal is +0545.

My application is dependent on the timezone string ("Asia/Kolkata"), so the imagemap is not a deal breaker, but accurate boundaries for the zones would be nice.

@quicksketch
Copy link
Owner

Thanks for posting this issue! TimezonePicker.com is based upon the standard Timezone DB timezones, which lists China as having 5 timezones (its actually a few more than that but it looks like 5: http://en.wikipedia.org/wiki/Time_in_China#IANA_time_zone_database).

It looks to me like even though these timezone names and boundaries are correct, it's only the offset that is wrong. In the case of China we should make a special exception for its timezones and set the offsets manually, making all 5 zones share the same offset as Asia/Shanghai.

@jace
Copy link
Author

jace commented Nov 8, 2012

FWIW, I use pytz in the back end, which uses the Olson database. The diagram over at Wikipedia shows four zones for China. As long as the widget and the backend use the same tz db, I guess it works.

@quicksketch
Copy link
Owner

Right, right. The Olson database another name for the Timezone Database (or the IANA Time Zone Database). China does have 5 timezone divisions. It's just that they're all the same timezone offset.

@quicksketch
Copy link
Owner

Hahah, I just figured out why this is occurring. It's because we used the UNIX epoch Jan 1 1970 as our empty time for comparison. And in 1970, China did have 5 different timezone offsets. If we use Jan 1 2012 instead, the offsets are calculated properly for China.

@quicksketch
Copy link
Owner

Well Wikipedia says that China has had a single timezone since 1949. So I'm not sure what the deal is. The above commit has fixed the problem. Now that I know PHP will generate different offsets based on the given date this should fix a couple other issues as well. http://timezonepicker.com/ has been updated to reflect the change.

@jace
Copy link
Author

jace commented Nov 13, 2012

Looks like Libya's just announced DST change will need the map to be refreshed again. http://www.timeanddate.com//news/time/libya-time-zone-change-2012.html

@quicksketch
Copy link
Owner

We always show the map in a non-DST state, otherwise the grouping appear very sporadic as countries do or do not support DST. So the addition of DST to a timezone makes no difference to the presentation of the map.

@quicksketch
Copy link
Owner

Ah, but Libya changed not only their DST but the timezone offset entirely:

On November 10, 2012, the clocks in Libya were to be turned back one hour from 02:00 (2am) to 01:00 (1am). This changes Libya's time zone from UTC+2 (Eastern European Time) to UTC+1 (Central European Time).

@quicksketch
Copy link
Owner

Our offsets are generated by PHP's implementation DateTimezone class, so next time we update PHP on timezonepicker.com it will affect generated maps. The codebase doesn't contain any offset information by itself.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants