trentrichardson / jQuery-Timepicker-Addon

Adds a timepicker to jQueryUI Datepicker
http://trentrichardson.com/examples/timepicker/
MIT License
2.66k stars 1.05k forks source link

Changing Months Incorrectly Affects Input #762

Open Guest98123 opened 9 years ago

Guest98123 commented 9 years ago

Thanks for the addon. See below, I simply included the javascript and assigned datetimepicker to an input. This occurs on the official example pages as well.

http://jsfiddle.net/8xjhjssm/

To replicate the issue, just click the blank input and click the next month button a couple of times, then try clicking the previous month button. You'll quickly notice it's assigning the wrong month to the input field as you move forward and back months. After you close the calendar, and reopen, the previous and next month buttons no longer change the dates, so the issue stops.

How I'm assuming it should work. Clicking the previous or next month buttons should never assign or change the input. If it's blank, it should stay blank until the user clicks a date.


Second related issue. If you set a minimum or maximum time, the previous and next month buttons may modify the input time incorrectly. See below, where I just set the minimum time to now, and maximum time 3 months from now, at 00:02.

http://jsfiddle.net/ucn9wg12/

To replicate, choose a date and time. Now, close and reopen the calendar to avoid the previous issue I mentioned, so we don't get both bugs happening at once. Now, just click ahead until the last month, 3 months in the future. You'll notice the time sliders automatically change to 00:02, but your input time remains the same. Now, click the previous month button. Suddenly, your input changes to 00:02. Try the reverse. Click all the way back to the first month. Once again, the sliders will change to the current time, and when you click the next month button, modify your input although you didn't make a selection.

In the above, I set the maxDate time to 00:02. This is because the bug will only happen if it's before the time you set on the input. And for the minDate, it's opposite, it'll cause the issue if it's after the input time.

Thanks for any help.