DateTime.DateTime incorrect addition with timezones

Bug #143942 reported by Eric Thomas
2
Affects Status Importance Assigned to Milestone
DateTime
Invalid
Medium
Unassigned

Bug Description

The code snippets below both try to add 31 days to the first day in October 31. I'm expecting this to result in the first day of November (2005/11/1)

Valid behavior:
>>> from DateTime import DateTime
>>> start=DateTime('2005/10/01 01:00:00 GMT-5')
>>> print start
2005/10/01 01:00:00 GMT-5
>>> earlyStart=start.earliestTime()
>>> print earlyStart
2005/10/01
>>> print earlyStart+31
2005/11/01

Invalid behavior: (Here's the problem)

>>> from DateTime import DateTime
>>> start=DateTime('2005/10/01 01:00:00 US/Central')
>>> print start
2005/10/01 01:00:00 US/Central
>>> earlyStart=start.earliestTime ()
>>> print earlyStart
2005/10/01
>>> print earlyStart+31
2005/10/31 23:00:00 US/Central

I've confirmed this occurs when using the US/ timezones (US/Pacific, US/Alaska, etc)

As you can see, the resulting date is coming up 1 hour short of the expected 2005/11/01.
This problem is known to cause certain products to deadlock a zope instance.

Tags: bug zope
affects: zope2 → datetime
Changed in datetime:
status: New → Confirmed
Revision history for this message
Colin Watson (cjwatson) wrote :

The datetime project on Launchpad has been archived at the request of the Zope developers (see https://answers.launchpad.net/launchpad/+question/683589 and https://answers.launchpad.net/launchpad/+question/685285). If this bug is still relevant, please refile it at https://github.com/zopefoundation/datetime.

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

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.