Thanks. Can you open a ticket at lighthouse?
https://mootools.lighthouseapp.com/projects/24057-mootoolsmore

On Tue, May 26, 2009 at 4:18 PM, Eneko Alonso (via Nabble) <
[email protected]<ml-user%[email protected]>
> wrote:

> Ok, I did some research and here is the problem. It seems like it has some
> issues with the daylight time change.
>
> var x = new Date();
> x.set('date', 1).clearTime();
> for (i=0; i<12; i++) {
>  console.log(x.increment('month'));
> }
>
> Mon Jun 01 2009 00:00:00 GMT-0700 (PDT) $family=Object
> Wed Jul 01 2009 00:00:00 GMT-0700 (PDT) $family=Object
> Sat Aug 01 2009 00:00:00 GMT-0700 (PDT) $family=Object
> Tue Sep 01 2009 00:00:00 GMT-0700 (PDT) $family=Object
> Thu Oct 01 2009 00:00:00 GMT-0700 (PDT) $family=Object
> Sun Nov 01 2009 00:00:00 GMT-0700 (PDT) $family=Object
> *Mon Nov 30 2009 23:00:00 GMT-0800 (PST) $family=Object*
> *Wed Dec 30 2009 23:00:00 GMT-0800 (PST) $family=Object*
> *Sat Jan 30 2010 23:00:00 GMT-0800 (PST) $family=Object*
> *Tue Mar 02 2010 23:00:00 GMT-0800 (PST) $family=Object*
> *Sat Apr 03 2010 00:00:00 GMT-0700 (PDT) $family=Object*
> *Mon May 03 2010 00:00:00 GMT-0700 (PDT) $family=Object*
>
>
> In order to fix this issue, since I only care about the date and not the
> time, I set the time to noon, so I always get the 1st of the month as
> expected:
>
> var x = new Date();
> x.set('date', 1).clearTime().set('hours', 12);
> for (i=0; i<12; i++) {
> console.log(x.increment('month'));
> }
>
> Mon Jun 01 2009 12:00:00 GMT-0700 (PDT) $family=Object
> Wed Jul 01 2009 12:00:00 GMT-0700 (PDT) $family=Object
> Sat Aug 01 2009 12:00:00 GMT-0700 (PDT) $family=Object
> Tue Sep 01 2009 12:00:00 GMT-0700 (PDT) $family=Object
> Thu Oct 01 2009 12:00:00 GMT-0700 (PDT) $family=Object
> Sun Nov 01 2009 11:00:00 GMT-0800 (PST) $family=Object
> Tue Dec 01 2009 11:00:00 GMT-0800 (PST) $family=Object
> Fri Jan 01 2010 11:00:00 GMT-0800 (PST) $family=Object
> Mon Feb 01 2010 11:00:00 GMT-0800 (PST) $family=Object
> Mon Mar 01 2010 11:00:00 GMT-0800 (PST) $family=Object
> Thu Apr 01 2010 12:00:00 GMT-0700 (PDT) $family=Object
> Sat May 01 2010 12:00:00 GMT-0700 (PDT) $family=Object
>
>
> I'll take a look at the source code and see if I can figure out a patch for
> this :)
>
>
>
> On Tue, May 26, 2009 at 3:53 PM, Eneko Alonso 
> <eneko.alo...@...<http://n2.nabble.com/user/SendEmail.jtp?type=node&node=2977948&i=0>
> > wrote:
>
>> I'm using Date.increment('month') from Mootools More 1.2.2.2 and I just
>> found it does not work as I expected.To me, add month means the day wont
>> change. Thus, if you add a month to January 1st 2009, it should return
>> February 1st 2009. But, if you keep adding 1 month at a time you will find
>> something like November 30th 2009.
>>
>> Either there is a bug on the function or is adding 30 days every time,
>> instead of a month.
>>
>> I haven't tested for end dates, but I'll understand these are more
>> complicated.
>>
>>
>> Whatever is the actual method implemented to increment months, it should
>> be better explained on the documentation:
>> http://mootools.net/docs/more/Native/Date
>>
>>
>>
>> Thanks :)
>>
>
>
>
> ------------------------------
>  View message @
> http://n2.nabble.com/-Moo--Date.increment%28%27month%27%29-not-working-as-expected-tp2977852p2977948.html
> To start a new topic under MooTools Users, email
> [email protected]<ml-node%[email protected]>
> To unsubscribe from MooTools Users, click here< (link removed) >.
>
>
>


-----
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-tp2977852p2977974.html
Sent from the MooTools Users mailing list archive at Nabble.com.

Reply via email to