Fix issue #135, time was set to NaN in some rare cases

This commit is contained in:
Alexander Gitter 2011-06-11 12:16:13 +02:00
parent 607577cefa
commit 2be272b34e

View file

@ -608,6 +608,11 @@ $.extend(Timepicker.prototype, {
second = (this.second_slider) ? this.second_slider.slider('value') : false,
timezone = (this.timezone_select) ? this.timezone_select.val() : false;
if (typeof(hour) == 'object') hour = false;
if (typeof(minute) == 'object') minute = false;
if (typeof(second) == 'object') second = false;
if (typeof(timezone) == 'object') timezone = false;
if (hour !== false) hour = parseInt(hour,10);
if (minute !== false) minute = parseInt(minute,10);
if (second !== false) second = parseInt(second,10);
@ -909,12 +914,13 @@ $.datepicker._setTime = function(inst, date) {
second = defaults.secondMin;
}
tp_inst.hour = hour;
tp_inst.minute = minute;
tp_inst.second = second;
if (tp_inst.hour_slider) tp_inst.hour_slider.slider('value', hour);
else tp_inst.hour = hour;
if (tp_inst.minute_slider) tp_inst.minute_slider.slider('value', minute);
else tp_inst.minute = minute;
if (tp_inst.second_slider) tp_inst.second_slider.slider('value', second);
else tp_inst.second = second;
tp_inst._onTimeChange();
tp_inst._updateDateTime(inst);