Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge pull request #8 from apenwarr/master

added timezone sorting based on offset and not name for simpler selection
  • Loading branch information...
commit 8da654820bc89ac5ecfde1d42958b4b522cf1a5f 2 parents ce12f45 + 3ce983c
@brosner 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.