This is a message.

Adding month with less days than current month skips a month Created May 31, 2011

This thread is solved

Views: 945     Replies: 10     Last reply Jun 2, 2011  
You must login first before you can use this feature

ThomasJ

Posts: 7

Registered:
Nov 19, 2009

Adding month with less days than current month skips a month

Posted: May 31, 2011

This issue can be reproduced with the example onhttp://flowplayer.org/tools/demos/dateinput/index.htm.

If you open the calender and select 31. May (or any other month with 31 days) and then click on the next-arrow, you will land on July. The previous-arrow does not work anymore.

Basically adding a month to any month with more days than the next or previous month will skip a month.

I have created an issue on githubhttps://github.com/jquerytools/jquerytools/issues/410

alibby

Posts: 1581

Registered:
Jun 2, 2010

» Adding month with less days than current month skips a month

Posted: May 31, 2011

Reply to: Adding month with less days than current month skips a month, from ThomasJ
Hi ThomasJ,

I've just tried to see if I get the same issue as you - I'm struggling to replicate this, using the demo link you posted? Just to confirm:

1. I click inside the text field - it shows the calendar.
2. Today (31st May) is selected - when I click on the next arrow, it takes me to June, as I would expect, and not July.

I've even tried doing it again, with an existing value in the text field - no change. I'm doing this in FF4 - which browser are you doing this in? Are you copying the demo code onto your PC, running it from there and making any changes at all? I'm running the demo as is directly from the site, and just can't seem to make it "fall over"...?

(P.S. I'm not one of the developers, just an intrigued user...!)

ThomasJ

Posts: 7

Registered:
Nov 19, 2009

» » Adding month with less days than current month skips a month

Posted: May 31, 2011

Reply to: » Adding month with less days than current month skips a month, from alibby
Hi Alibby

My instructions missed something. You need to click on the 31st May again, even if it's already selected. However, I'm not able to reproduce the error at this moment. I'm 100% sure it was there earlier today. I tested with Firefox 3.6.17.

I even filed a bug on Github, but I see no actioning there, so I'm a bit suprised now. Will check again tomorrow.

alibby

Posts: 1581

Registered:
Jun 2, 2010

» » » Adding month with less days than current month skips a month

Posted: May 31, 2011

Reply to: » » Adding month with less days than current month skips a month, from ThomasJ
Hi ThomasJ,

Ah OK - hehe: believe it or not, I can actually replicate it, but not where you expect:

If you go to the Demo page here:http://flowplayer.org/tools/demos/dateinput/index.html, and then try what you suggest, then yes, you can get the same effect. However, if you go tohttp://flowplayer.org/tools/demos/dateinput/index.htm (the standalone version of the same demo), you should find that it works fine?

ThomasJ

Posts: 7

Registered:
Nov 19, 2009

» » » » Adding month with less days than current month skips a month

Posted: Jun 1, 2011

Reply to: » » » Adding month with less days than current month skips a month, from alibby
Hi Alibby

Thanks for the hint. I tested both links right now and I can reproduce the error in both cases. Wow, now I'm wondering if the issue depends on the time of day. I'm not sure why, but it's the only explanation I have right now.

I've created a screencast using Firefox 3.6.17 showing the issue:
http://www.screencast.com/t/fePLrPH1VGF

PowerWill500

Posts: 1

Registered:
Jun 1, 2011

» » » » » Adding month with less days than current month skips a month

Posted: Jun 1, 2011

Reply to: » » » » Adding month with less days than current month skips a month, from ThomasJ
I've noticed this issue as well, and it seems to me that it's a huge flaw. The proper authorities should be alerted immediately. Anyone know how to do that?

alibby

Posts: 1581

Registered:
Jun 2, 2010

» » » » » » Adding month with less days than current month skips a month

Posted: Jun 1, 2011

Reply to: » » » » » Adding month with less days than current month skips a month, from PowerWill500
Hi,

A question - have you tested the STANDALONE demo, to which a link is available from the bottom of the main demo? This works fine - this is the important bit. It is perfectly possible that the issue on the main demo is down to a conflict in CSS, or the script on the main page?

ThomasJ

Posts: 7

Registered:
Nov 19, 2009

» » » » » » » Adding month with less days than current month skips a month

Posted: Jun 2, 2011

Reply to: » » » » » » Adding month with less days than current month skips a month, from alibby
Hi alibby

Using Firefox 3.6.17 (on Mac OS X) I get the same result for both versions. If I select the 31. May and hit the arrow, I jump to July, standalone or not.

Using Safari 5.0.5 the standalone works but the main demo reacts the same as in Firefox.

tsaunat

Posts: 3

Registered:
Apr 20, 2011

nope, but I did program a fix for myself if it helps

Posted: Jun 1, 2011

Reply to: » » » » » Adding month with less days than current month skips a month, from PowerWill500
Making changes helps if it's not the min version...
change addMonth: function to look like this

addMonth: function(amount) {
       while (new Date(currYear,currMonth+(amount || 1),currDay).getMonth() !=currMonth+(amount||1))
                 {currDay--;}
return this.setValue(currYear, currMonth + (amount || 1), currDay);
                        },
This will reduce the day as needed to not roll two months at a time.

alibby

Posts: 1581

Registered:
Jun 2, 2010

» nope, but I did program a fix for myself if it helps

Posted: Jun 1, 2011

Reply to: nope, but I did program a fix for myself if it helps, from tsaunat
Thanks for this - I think ThomasJ has posted a bug report in Github (link at the start of this thread). Could you please post it there if possible?

ThomasJ

Posts: 7

Registered:
Nov 19, 2009

» nope, but I did program a fix for myself if it helps

Posted: Jun 2, 2011

Reply to: nope, but I did program a fix for myself if it helps, from tsaunat
Hi tsaunat

Thanks for the post. I haven't tested you code yet, but I have posted it on https://github.com/jquerytools/jquerytools/issues/410, the link alibby mentioned above.