Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Timezone sorting #8

Merged
merged 1 commit into from

3 participants

@apenwarr

Hi,

I added a simple patch to change the way timezones are sorted by default, in a way that I think is more user friendly. With this change, we sort by (GMT offset, name) rather than just by (name). Since the names tend to be hard to guess - my personal timezone is "America/Vancouver" even though I'm in Canada? - this makes it easier to find things in the list.

Have fun,

Avery

@brosner brosner merged commit 8da6548 into from
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Nov 28, 2010
  1. @apenwarr
This page is out of date. Refresh to see the latest.
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:]
Something went wrong with that request. Please try again.