DateTime
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
DateTime |
Invalid
|
Medium
|
Unassigned |
Bug Description
Dates of the form YYYY-MM-DD which are not ISO 9610 dates should be interpreted in the local timzone context (as are all other date forms) whereas ISO9610 dates need to be interpreted as GMT. The patch below fixes the constructor to use the local timezone for dates which are not
in ISO9610 format. It also fixes a minor problem in the recognition of ISO9610 dates.
.
--- DateTime.py.orig Sun Jun 12 12:56:02 2005
+++ DateTime.py.patched Tue Jun 21 22:50:06 2005
@@ -1743,20 +1743,28 @@
z = fields[7]
if z and z.startswith('Z'):
- # Waaaa! This is wrong, since 'Z' and '+HH:MM'
- # are supposed to be mutually exclusive.
- # It's only here to prevent breaking 2.7 beta.
- z = z[1:]
-
- if z:
+ # OK this is gmt, hour_off and min_off are zero
+ tz = 'GMT%+03d%02d' % (hour_off,min_off)
+ if len(z)>1:
+ raise IndexError
+ elif z:
+ tz = 'GMT%+03d%02d' % (hour_off,min_off)
if fields[4]:
- return year,month,
+ else:
+ z = _calcDependentS
+ tz = self._calcTimez
+
+ else:
+ z = _calcDependentS
+ tz = self._calcTimez
+
+ return year,month,
def JulianDay(self):
"""
affects: | zope2 → datetime |
Please provide a unit test demonstrating the correct behaviour and failing with the old code.