[Zope] Strange date handling problems

Jim Fulton jim.fulton@digicool.com
Mon, 08 Feb 1999 10:39:18 -0500


There have been a number of changes to DateTime since Zope 1.9.
Many of these related to numeric/date conversion and math.

We are going to make a 1.10 pre-release today.  Please see if the
new DateTime gives you any trouble.  It did the right thing
for me with the expressions below.

Jim

Ty Sarna wrote:
> 
> I'm getting unexpected results when doing computations on DateTime
> instances. For example, the following should always result in 'd' being the
> first of the previous month to 'date':
> 
> d = date - date.day()           #       1999/5/14 - 13 = 1999/4/30
> d = d - (d.day() - 1)           #       1999/4/30 - (30 - 1) =
>                                 #       1999/4/30 - 29 = 1999/4/1
> 
> Thie works great, unless 'date' is in May, in which case I end up with
> 1999/3/31 instead. A similar computation to find the first of the next
> month also gives strange results if the start date is in March. In other
> words, if the correct result is April Fool's, I get something else
> instead!
> 
> Another, more involved set of calculations gives incorrect results for
> most dates in October, but is fine for any other month. What's going on?
> 
> _______________________________________________
> Zope maillist  -  Zope@zope.org
> http://www.zope.org/mailman/listinfo/zope


--
Jim Fulton           mailto:jim@digicool.com
Technical Director   (888) 344-4332              Python Powered!
Digital Creations    http://www.digicool.com     http://www.python.org

Under US Code Title 47, Sec.227(b)(1)(C), Sec.227(a)(2)(B) This email
address may not be added to any commercial mail list with out my
permission.  Violation of my privacy with advertising or SPAM will
result in a suit for a MINIMUM of $500 damages/incident, $1500 for
repeats.