1

Part of my Django web app is a meeting scheduler which is timezone sensitive.

Currently it's using pytz, but this has some severe shortcomings.

For instance, the timezone for Moscow is currently off by 1 hour because of the recent decision of President Medvedev to abolish the switch to winter time in Russia ( http://en.ria.ru/russia/20111030/168271560.html )

Another severe problem, is that the list of timezones which it provides is very long and highly unfriendly to the users, e.g. "Asia/Shangri-La". Most of the serious sites which are offering some time zone selection combo box have a far shorter list...

I'm looking for some reliable solution to provide accurate time zones and friendly timezone selections to users, either as a library that updates whenever there's a major change like the above in Russia, or as a reliable and free web service.

GJ.
  • 5,226
  • 13
  • 59
  • 82
  • Note that despite what some articles made it sound like, the Russian decision to not change the time last fall was made about six months prior--almost one year ago now. I wonder if the latest development version of pytz has it right or not. – John Zwinck Feb 09 '12 at 00:00

2 Answers2

1
  1. You will need to obtain a version of pytz that contains an up-to-date Olson/Eggert database that respects the recent time zone policy change for Russia. However, apparently there is a copyright lawsuit in progress against the maintainers, so that might not happen for a while. http://en.wikipedia.org/wiki/Tz_database#Maintenance I suppose you could get the pytz source and contribute a patch yourself. But to my knowledge, all or nearly all time zone systems that work well are based on the Olson/Eggert system.

  2. You can make the user experience easier by using the various lookups that are provided. pytz.common_timezones is a pruned list of only the time zone identifiers that are likely to matter most to users. pytz.country_names is a dictionary of country code to country name (in English) for display to the user. pytz.country_timezones is a dictionary of country code to a list of time zones for that country. By using these, you can have the user select their country, and then the most applicable time zone for that country, optionally only showing choices in the common_timezones list.

  3. Probably the absolute simplest UI for choosing a time zone I've seen is the world map where you click your location and it figures out which Olson/Eggert time zone that likely is. The one in Ubuntu claims to be based on a system from http://www.geonames.org/. Apart from that, I think pytz or maybe the times module jcollado linked to is about as good as it gets. Political time zones are complicated, therefore so will be any code to work with them.

Please also consider my answer to an earlier question on the topic of automatically determining the browser's time zone. There is a usually-correct way to do it in JavaScript linked in the comments.

Community
  • 1
  • 1
wberry
  • 18,519
  • 8
  • 53
  • 85
0

Recently I saw in reddit the announcement of times which is a library designed to deal with datetime objects and time zones easily.

Maybe this library doesn't take into account the problem you mention regarding the Moscow timezone. However, since the library is being actively developed (last change was committed less than one day ago), I'd say the main developer would be willing to help out, accept patches, etc.

jcollado
  • 39,419
  • 8
  • 102
  • 133