DateTime

Bug #143438 reported by dennis allison on 2005-06-22
2
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:
                 fields = zonereg.split(z)
                 hour_off = int(fields[1])
                 min_off = int(fields[3])
+ tz = 'GMT%+03d%02d' % (hour_off,min_off)
                 if fields[4]:
                     # Garbage after time zone
                     raise IndexError

- return year,month,day,hour,minute,seconds,'GMT%+03d%02d' % (hour_off,min_off)
+ else:
+ z = _calcDependentSecond2(year,month,day,hour,minute,seconds)
+ tz = self._calcTimezoneName(z, 0)
+
+ else:
+ z = _calcDependentSecond2(year,month,day,hour,minute,seconds)
+ tz = self._calcTimezoneName(z, 0)
+
+ return year,month,day,hour,minute,seconds,'%s' % tz

     def JulianDay(self):
         """

Florent Guillaume (efge) wrote :

Please provide a unit test demonstrating the correct behaviour and failing with the old code.

affects: zope2 → datetime

There are no examples here that would allow anyone to reproduce the alleged problem. In order for anyone to fix this bug they have to know *what* exactly they are fixing.

Changed in datetime:
status: New → Incomplete

We are closing this bug report because it lacks the information we need to investigate the problem, as described in the previous comments. Please reopen it if you can give us the missing information, and don't hesitate to submit bug reports in the future. To reopen the bug report you can click on the current status, under the Status column, and change the Status back to "New". Thanks again!

Changed in datetime:
status: Incomplete → Invalid
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers

Bug attachments