On Tue, 11 Mar 2003 10:46:32 -0800, [EMAIL PROTECTED] wrote: >On Monday, March 10, 2003, at 07:10 PM, Dave Rolsky wrote: >> On Sat, 1 Mar 2003, Bruce Van Allen wrote: >>> I agree with these thoughts and principles, but thinking of months as >>> discrete units also has complications, as you say, with "weird >>> unpredictable results": >[snip] >> That's why there is an "eom_mode" (end of month mode) parameter for the >> DateTime::Duration constructor, which allows you to control how adding >> months is handled.
I think the parameter got renamed to "end_of_month". >Excellent. > > - Bruce In your examples, you showed a "business" month=30 days calculation. Should we have such a 'business' mode? Existing modes are wrap (the default), limit, and preserve: Assuming adding X months to month M, day D: wrap will give D-1 days after the first of month M+X limit will give month M+X with the day being the earlier of D and the last day of the month preserve will give the last day of month M+X if D is the last day of M; otherwise it will give the same result as limit On another topic, just below add_duration in DateTime.pm, I see this: use constant INFINITY => 100 ** 100 ** 100 ; use constant NEG_INFINITY => -1 * (100 ** 100 ** 100); I remember this (how to produce an numeric infinity) coming up on perl5-porters and seem to recall that the above just coredumps on some platforms.