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

As a point of reference, the ADD_MONTHS function in Oracle would return the last day of February in that situation. Subtracting a month from March 30 would also return February 29.

I think that approach makes the most sense. The programmer can choose whether or not to verify the dates before adding/subtracting months (if an error were returned, the programmer would be forced to check each date). And, I agree with Blue that adding one month should always return a date in the next month, and should not wrap over to the month after that.

Replies are listed 'Best First'.
Re: Re: Year /^\d+$/ bug!
by $code or die (Deacon) on Nov 30, 2000 at 01:03 UTC
    Yes, I definitely agree that it shouldn't wrap over to the next month or you will lose a month - could be costly if your your company pays your check on the 31st of each month! :) Still, something seems fishy.