Kaydet (Commit) b984505d authored tarafından Malcolm Tredinnick's avatar Malcolm Tredinnick

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

Fixed #5470 -- Fixed the 'Z' time format marker in templates to handle timezones west of UTC. Thanks, Paul Lanier.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@6275 bcc190cf-cafb-0310-a4f2-bffc1f526a37
üst c96c57af
...@@ -182,6 +182,7 @@ answer newbie questions, and generally made Django that much better: ...@@ -182,6 +182,7 @@ answer newbie questions, and generally made Django that much better:
lakin.wecker@gmail.com lakin.wecker@gmail.com
Nick Lane <nick.lane.au@gmail.com> Nick Lane <nick.lane.au@gmail.com>
Stuart Langridge <http://www.kryogenix.org/> Stuart Langridge <http://www.kryogenix.org/>
Paul Lanier <planier@google.com>
Nicola Larosa <nico@teknico.net> Nicola Larosa <nico@teknico.net>
Eugene Lazutkin <http://lazutkin.com/blog/> Eugene Lazutkin <http://lazutkin.com/blog/>
Jeong-Min Lee <falsetru@gmail.com> Jeong-Min Lee <falsetru@gmail.com>
......
...@@ -248,10 +248,15 @@ class DateFormat(TimeFormat): ...@@ -248,10 +248,15 @@ class DateFormat(TimeFormat):
return doy return doy
def Z(self): 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 Time zone offset in seconds (i.e. '-43200' to '43200'). The offset for
is always positive.""" timezones west of UTC is always negative, and for those east of UTC is
return self.timezone.utcoffset(self.data).seconds 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): def format(value, format_string):
"Convenience function" "Convenience function"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment