[ZCM] [ZC] 2291/ 3 Comment "DateTime trouble parsing daylight savings time"
"Collector: Zope Bugs, Features, and Patches ..." <[email protected]> Fri, 18 May 2007 15:50:33 -0400
| Newsgroups | gmane.comp.web.zope.devel.collector-monitor |
|---|---|
| Message-ID | <[email protected]> |
Issue #2291 Update (Comment) "DateTime trouble parsing daylight savings time"
Status Pending, Zope/bug medium
To followup, visit:
http://www.zope.org/Collectors/Zope/2291
==============================================================
= Comment - Entry #3 by robrien on May 18, 2007 3:50 pm
I added entries
'edt':'US/Eastern', etc...
to the to the _zmap dict.
It appears that DST is calculated via time.daylight so mapping xDT to US/<zone> should be fine. I think;) Or I am an hour off.
________________________________________
= Edit - Entry #2 by ajung on Mar 15, 2007 12:29 am
Changes: submitter email, importance (critical => medium), new comment
This is not critical
________________________________________
= Request - Entry #1 by bticc on Mar 14, 2007 11:06 pm
DateTime is raising a SyntaxError when encountering datetime strings that have daylight savings time zones such as EDT, CDT, MDT, PDT. This can be tested as follows:
[pts6][zope@horus DateTime]$ python
Python 2.4.3 (#1, Jun 14 2006, 14:53:31)
[GCC 4.0.2 20051125 (Red Hat 4.0.2-8)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from DateTime import DateTime
>>> dt = DateTime('Wed, 14 Mar 2007 09:44:06 EDT')
Traceback (most recent call last):
File "<stdin>", line 1, in ?
File "/usr/lib/zope2/lib/python/DateTime/DateTime.py", line 555, in __init__
return self._parse_args(*args, **kw)
File "/usr/lib/zope2/lib/python/DateTime/DateTime.py", line 798, in _parse_args
yr,mo,dy,hr,mn,sc,tz=self._parse(arg, datefmt)
File "/usr/lib/zope2/lib/python/DateTime/DateTime.py", line 1087, in _parse
raise SyntaxError, st
DateTime.SyntaxError: Wed, 14 Mar 2007 09:44:06 EDT
>>> dt = DateTime('Wed, 14 Mar 2007 09:44:06 EST')
>>> print dt.timezone()
US/Eastern
>>> dt = DateTime('Wed, 14 Mar 2007 09:44:06 CDT')
Traceback (most recent call last):
File "<stdin>", line 1, in ?
File "/usr/lib/zope2/lib/python/DateTime/DateTime.py", line 555, in __init__
return self._parse_args(*args, **kw)
File "/usr/lib/zope2/lib/python/DateTime/DateTime.py", line 798, in _parse_args
yr,mo,dy,hr,mn,sc,tz=self._parse(arg, datefmt)
File "/usr/lib/zope2/lib/python/DateTime/DateTime.py", line 1087, in _parse
raise SyntaxError, st
DateTime.SyntaxError: Wed, 14 Mar 2007 09:44:06 CDT
>>> dt = DateTime('Wed, 14 Mar 2007 09:44:06 CST')
>>> print dt.timezone()
US/Central
The results are the same for Mountain and pacific time as well.
I have not yet found a fix for this problem. I discovered it using PloneFeedFeeder when trying to parse a news feed with the datetime stamp used in this example.
==============================================================