Zope DateTime, Careful with that Dash, Eugene
The Zope DateTime library is used in several places inside of Plone. As part of the Plone 4 release cycle, the underlying Zope version was upgraded from 2.10 to 2.12. Tucked away in this version of the DateTime library is this:
Note that the Zope DateTime parser assumes timezone naive ISO strings to be in UTC rather than local time as specified.
This is an unexpected behavior change that can bite you in various ways. For example, in previous versions of Plone this is what happened:
>>> from DateTime import DateTime >>> dash_date = '2012-10-03' >>> slash_date = '2012/10/03' >>> DateTime(dash_date) DateTime('2012/10/03') >>> DateTime(slash_date) DateTime('2012/10/03')
In the current version, this happens instead:
>>> from DateTime import DateTime >>> dash_date = '2012-10-03' >>> slash_date = '2012/10/03' >>> DateTime(dash_date) DateTime('2012/10/03 00:00:00 GMT+0') >>> DateTime(slash_date) DateTime('2012/10/03 00:00:00 GMT-4')
Note the timezone change: one gets parsed into UTC, the other the local machine timezone. This is because the parser is using the ISO format due to the dashes in the string. This led to several unexpected behavior changes:
If you're writing custom code for Plone 4, it is a good idea to double-check how your application processes date / time input to ensure the timezone is correctly handled.