Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fixed #5470 -- Fixed the 'Z' time format marker in templates to handl…

…e timezones west of UTC. Thanks, Paul Lanier.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@6275 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit b984505d1367da35d38ae3c2a81a610d8657300a 1 parent c96c57a
@malcolmt malcolmt authored
Showing with 10 additions and 4 deletions.
  1. +1 −0  AUTHORS
  2. +9 −4 django/utils/dateformat.py
View
1  AUTHORS
@@ -182,6 +182,7 @@ answer newbie questions, and generally made Django that much better:
lakin.wecker@gmail.com
Nick Lane <nick.lane.au@gmail.com>
Stuart Langridge <http://www.kryogenix.org/>
+ Paul Lanier <planier@google.com>
Nicola Larosa <nico@teknico.net>
Eugene Lazutkin <http://lazutkin.com/blog/>
Jeong-Min Lee <falsetru@gmail.com>
View
13 django/utils/dateformat.py
@@ -248,10 +248,15 @@ def z(self):
return doy
def Z(self):
- """Time zone offset in seconds (i.e. '-43200' to '43200'). The offset
- for timezones west of UTC is always negative, and for those east of UTC
- is always positive."""
- return self.timezone.utcoffset(self.data).seconds
+ """
+ Time zone offset in seconds (i.e. '-43200' to '43200'). The offset for
+ timezones west of UTC is always negative, and for those east of UTC is
+ always positive.
+ """
+ offset = self.timezone.utcoffset(self.data)
+ # Only days can be negative, so negative offsets have days=-1 and
+ # seconds positive. Positive offsets have days=0
+ return offset.days * 86400 + offset.seconds
def format(value, format_string):
"Convenience function"
Please sign in to comment.
Something went wrong with that request. Please try again.