Commit 4f48e524 authored by Lennart Regebro's avatar Lennart Regebro

Fixed issue #1127

parent 9bd21633
......@@ -1476,11 +1476,7 @@ class DateTime:
def strftime(self, format):
# Format the date/time using the *current timezone representation*.
diff = _tzoffset(self._tz, self._t)
format = re.sub('(^\|[^%])%z',
'\\1%+05d' % (diff / 36),
format)
return strftime(format, safegmtime(self.timeTime() + diff))
return strftime(format, safelocaltime(self.timeTime()))
# General formats from previous DateTime
def Date(self):
......
......@@ -7,6 +7,7 @@ import os
import time
import unittest
from DateTime.DateTime import _findLocalTimeZoneName
from DateTime import DateTime
try:
......@@ -338,6 +339,16 @@ class DateTimeTests(unittest.TestCase):
except DateTime.TimeError:
self.fail('Zope Collector issue #484 (negative time bug): '
'TimeError raised')
def testStrftimeTZhandling(self):
'''strftime timezone testing'''
# This is a test for collector issue #1127
format = '%Y-%m-%d %H:%M %Z'
dt = DateTime('Wed, 19 Nov 2003 18:32:07 -0215')
dt_string = dt.strftime(format)
dt_local = dt.toZone(_findLocalTimeZoneName(0))
dt_localstring = dt_local.strftime(format)
self.assertEqual(dt_string, dt_localstring)
def test_suite():
......
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