Closed triemstr closed 13 years ago
Fixed in 'triemstr' fork. Please merge in the fork, specifically: http://github.com/triemstr/calendar_date_select/commit/4a8acb5042bdfa2112f611a6e5ee4b688dc03482
Man, thanks for your fix, but it only solved the onmouseover problem, when you select the date the problem persists.
I missed that while testing. Now seems ok for mouseover and selecting.
timcharper, please merge in this fork. I'm still a beginner so if there is anything else you need me to do to make this happen, please let me know. I don't know how to make a patch per the README but hope merging should work just as well.
triemstr, thank you
triemstr, I know i'm bothering you, but... if today is September, 1st and I try to click on August, 31th it goes to August 1st
fredhp, it isn't annoying. This is a tricky bug and it needs to be right. We're experiencing the same problem but in reverse now. I have disabled time in my version and only use day, month, year. So if you use time in yours, make sure it still works.
The Change: Basically instead of setting day, month, and year individually as has been done historically, I set them all at once and the JS Date function figures it out correctly.
Can you check again? I appreciate the testing.
triemstr, it's perfect now. Thank you
Hey triemstr,
I'm having the same problem you described and your fix works fine according to my tests. timcharper, can you merge this fork?.
Thanks, Anibal Cucco
Hey guys,
Thanks for fix and testing! Tim is not available at the moment due to family matter.
I have incorporated the fix. Thanks for the patch, triemstr. In the future, you can just send me a pull request.
Thanks! Lee
Will do...happy this was merged and happy to have learned about the pull request.
With selected date as the 31st of any given month, selecting "next month", then mouseover on days and you will see the incorrect month. Here is an example:
Pre-select October 31, 2010. Then open the js calendar again. Advance to the next month which would be November. November looks ok in the grid. But, mouseover or select any date in the November grid and you are left with the month of December instead. If you choose November 10, you will get December 10 (12/10/2010).
The problem is in calendar_date_select.js line 316. First the hover_date is created with October 31, 2010 as the date with the intention of replacing the day, month, and year. Year is replaced no problem with hover_date.setYear(element.year).
But then hover_date.setMonth does have a problem. See October 31, advanced to the next month would theoretically give you November 31, 2010. Since there is no November 31, 2010, the JavaScript Date call magically advances you to December 31, 2010.
If you call hover_date.setDate(element.day) first, then the day is changed to the 10th so we would have October 10, 2010, then setMonth(element.month) would change the month to November 10, 2010, and we'd be all set.
So switch hover_date.setDate so that it is before hover_date.setMonth, and it works.