Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Sort timezones in order of GMT offset, not just name.

  • Loading branch information...
commit 3ce983c23b50ee5277c6ba6c5b7af9952a281cd7 1 parent 2b903a3
@apenwarr apenwarr authored
Showing with 5 additions and 1 deletion.
  1. +5 −1 timezones/zones.py
View
6 timezones/zones.py
@@ -10,4 +10,8 @@
for tz in pytz.common_timezones:
now = datetime.now(pytz.timezone(tz))
- PRETTY_TIMEZONE_CHOICES.append((tz, "(GMT%s) %s" % (now.strftime("%z"), tz)))
+ ofs = now.strftime("%z")
+ PRETTY_TIMEZONE_CHOICES.append((int(ofs), tz, "(GMT%s) %s" % (ofs, tz)))
+PRETTY_TIMEZONE_CHOICES.sort()
+for i in xrange(len(PRETTY_TIMEZONE_CHOICES)):
+ PRETTY_TIMEZONE_CHOICES[i] = PRETTY_TIMEZONE_CHOICES[i][1:]
Please sign in to comment.
Something went wrong with that request. Please try again.