At 2:51 pm -0700 2004-09-01, Bruce Van Allen wrote:
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'.


I've realised my mistake, and withdraw my request from a few days back. I agree that in date math there should be the right behaviour, however this wasn't in the math it was in a set.
$dt->set( month=>2, day=>30 );


Now you either typed in the wrong thing there or you made a mistake like I did:
for (1..12){
        $dt->set( month=>$_, day=>30)
}

It's right to cause a die there because DT has no idea what I'm doing. I may have entered static value as in the top, or I might be using a rolling variable as in the bottom. If I'm using a rolling value I should be relying on date math, not a for loop.

The fix is as simple as either specifying a day that is in every month, or using date math and just adding a month (with limit or preserve)

Cheers!
Rick

--
--------------------------------------------------------
            There are 10 kinds of people:
  those that understand binary, and those that don't.
--------------------------------------------------------
  The day Microsoft makes something that doesn't suck
    is the day they start selling vacuum cleaners
--------------------------------------------------------
"Write a wise proverb and your name will live forever."
   -- Anonymous
--------------------------------------------------------

Reply via email to