This is similar to the beforeShowDay callback found in the DatePicker
widget from jquery UI
(http://api.jqueryui.com/datepicker/#option-beforeShowDay). The only
omission is a custom tooltip for the date.
The beforeShowDay callback can be supplied when creating an instance of
the DateTimePicker.
This commit is fixing a bug which occured during date selection. When selecting a day of the previous month which is higher than the current date's day the wrong date will be selected. This happens because setting a day with setDate() which is higher than the current month will automatically change the day to a lower number. That's why the month has to be set before the day.
How to reproduce: Let's say February, 26th is selected and then the user wants to switch to January, 30th then January, 2nd will be selected instead.
When you set the month in JS, if the current day is greater than the number
days in the new month, the date will be updated to acccount for that by
bumping the date out to the next month.
e.g. (Jan 30).setMonth(1) will result in Mar 2 since Feb only has 28 days.
The proposed fix sets the date first to be never more than the potential
number of days in the month, then sets the month.
Also, for direct access to the month, we set the desired day first THEN
the desired month. This accounts for the case where you are on Jan 30, then
hit the "1" for February and it jumps to march.
Added two options
todayButton:true, // 2.1.0
defaultSelect:true, // 2.1.0
todayButton - show button "Go To Today"
defaultSelect - select current date and time if input empty
It's a fix to the fix I made couple of days ago. I've forgotten to use new value
after calculating new position for widget when it doesn't fit the place
on the right side of the input field. Sorry!