[Zope-dev] DateTime iso8601 bad handling of dates

Evan Simpson evan at 4-am.com
Wed Nov 30 12:06:56 EST 2005


This has been brought up and (rather cavalierly) dismissed before.  I
challenge anyone to justify the following DateTime behavior:

>>> DateTime('2005-01-01').strftime('%Y-%m-%d')
'2004-12-31'

DateTimes are actually timestamps, and the current implementation
assumes that a date in ISO8601 format without a timezone specifier is
UTC rather than local.

It was asserted, last time this came up, that this is compliant with the
ISO8601 spec, but my own research shows this to be false.  If someone
can point me to a truly authoritative source that supports the current
behavior, I would appreciate it, but that would not change the fact that
the manifested behavior is *broken*.

This is a simple two-line fix, folks.  I've already done it on my
production systems.

Cheers,

Evan @ 4-am



More information about the Zope-Dev mailing list