Actually, after a bit of thought and discussion, I'm coming around to thinking that jan 30 + 1 month means feb MAX. If you think of it in terms of billing, if you buy something from me on Dec 31 and I tell you that you can pay me in two months, I don't mean some time in March. I mean the end of Feb. Dates are so messed up. I'm not sure we'll change it, but we'll consider it.
On Wed, May 27, 2009 at 8:47 AM, Aaron Newton <[email protected]> wrote: > On Wed, May 27, 2009 at 8:19 AM, Eneko Alonso (via Nabble) < > [email protected]<ml-user%[email protected]> > > wrote: > >> Well, adding/subtracting months is pretty tricky sometimes, especially if >> the date is at the end of the month. Mootools, overall, should behave >> like all frameworks do on any language. Add/SubMonths are common functions >> on many languages, so maybe someone should take a look at how do they work >> in PHP, MySQL, etc.. >> >> Either way, I think Mootools should rely on date.setMonth(date.getMonth() >> + 1) which seem to work fine in all cases. >> > > Eneko, what would happen if you did that for Jan 30? What would > incrementing the month do there? Would it transform to Feb 28 (29th in a > leap year)? Or would it instead become Mar 3. > > As much as I'd like to think that incrementing the month should just "add > one to the month column", I can't think of how that should work. A month > after Jan 30 requires some sort of non-trivial logic on our part. Either we > take the remainder and apply it (giving us March 2nd) or we have to drop the > remainder and give you Feb 28th (or 29th). This is ambiguous to me. As much > as I don't love it, I think I agree with Scott. The remainder should apply. > ----- The MooTools Tutorial: http://www.mootorial.com www.mootorial.com Clientcide: http://www.clientcide.com www.clientcide.com -- View this message in context: http://n2.nabble.com/-Moo--Date.increment%28%27month%27%29-not-working-as-expected-tp2977852p2982061.html Sent from the MooTools Users mailing list archive at Nabble.com.
