in reply to Re: Year /^\d+$/ bug!
in thread Year /^\d+$/ bug!

Hmmm, I just tried it again and it seems to work:
perl -MDate::Calc -MData::Dumper -e "print Dumper(\Date::Calc::Add_Delta_YMD(2001,1,29,0,+1,0));" and it printed:
$VAR1 = \2001; $VAR2 = \2; $VAR3 = \28;
I tried it several different ways and all of them seemed to work now. Maybe the author of Date::Calc saw my post, wrote a fix, hacked my box and replaced by buggy module with a new version!

Or maybe I didn't test it properly before I posted.

Well, as far as Date::Calc is concerned (if we are to believe it) we should truncate it down to Feb 28th.

I don't quite feel at ease about this, but my world view is now secure again - I can say with confidence the exact date in one month's time!

Replies are listed 'Best First'.
Re: Re: Re: Year /^\d+$/ bug!
by extremely (Priest) on Nov 30, 2000 at 04:42 UTC
    The business answer is to truncate and stay at the end of the month. I asked an accountant who audits code more than a year ago since the guys I worked with couldn't agree. His point was that If you are in January, adding one month should NEVER get you March. =)

    --
    $you = new YOU;
    honk() if $you->love(perl)

Re: Re: Re: Year /^\d+$/ bug!
by Blue (Hermit) on Nov 30, 2000 at 01:05 UTC
    Ah yes, but can you tell "1 day" later when daylight savings is involved. 8) 23 hours one way, 25 the other.

    Those wacky humans...

    =Blue
    ...you might be eaten by a grue...

      How are we expected to live like this!!! I need to know that blue is blue and green is green. I need to know that there are 86400 seconds in a day and 2,???,??? seconds in a month!!!

      From now on I work onlly in seconds from the epoch - if someone asks me the time, I will say "975,528,976". If they ask me for the date, I will be able to say the same thing. Perfect!