This change prevents the DateTimePicker from closing Bootstrap (and other) modals, pop-ups, and drop downs on the selection of the date, by stopping propagation of the click.
Changing the DateTimePicker to close on the selection of a datetime, restores the previous behaviour.
Rather than calling the function regardless if the user wished to
perform a check on each date, only call the method if the user
explicitly defined it in the options object passed to datetimepicker.
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.