On 8/31/04 Dave Rolsky wrote:
>On Tue, 31 Aug 2004, Rick Measham wrote:
>> At 9:33 am -0700 2004-08-30, Jonathan Leffler wrote:
>> >It looks like the test is trying to use February 30th.  My
>> >impression is that the problem is in the test, not the module being
>> >tested.
>> Dave, this looks more like an error in DateTime ... shouldn't
>> setting the month work like adding a month and have it roll over ...
>> or better shouldn't it truncate it to the month length?
>> is that the error shouldn't occur. 
>I think throwing an error is the best thing here.  It's really hard
>for me to do something "reasonable" (as in obvious to most people)
>when you try to convert the date to Feb 30.  You came up with two
>reasonable suggestions all by yourself ;)
>
>And really, I think that this code is indicative of a logical error in
>the caller's code, or bad user input being passed through, and
>throwing an error makes it obvious this happened.  Truncating or
>rolling-over will simply mask the error, which will translate into
>corrupt data somewhere down the line.

Pace that, the list had extensive discussion early on about specifying
end-of-month handling when doing date calcs. Hence the 'wrap', 'limit',
and 'preserve' modes for the end_of_month parameter in DT::Duration.

Absent such a parameter, no date calculation would be correct in the
usual meaning of 'correct'.


- Bruce

__bruce__van_allen__santa_cruz__ca__

Reply via email to