Skip to content

Commit 4862093

Browse files
committed
Bugfix for correct timepicker injection
Prevents beforeShow from being called twice, which prevents injectTimepicker from being called twice
1 parent 496ee3a commit 4862093

File tree

1 file changed

+3
-17
lines changed

1 file changed

+3
-17
lines changed

jquery-ui-timepicker-addon.js

Lines changed: 3 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,6 @@ $.extend(Timepicker.prototype, {
121121
$input.trigger("focus");
122122
});
123123
tp_inst.inst = dp_inst;
124-
tp_inst._addTimePicker();
125124
if ($.isFunction(o.beforeShow))
126125
o.beforeShow(input, dp_inst);
127126
},
@@ -437,7 +436,7 @@ $.extend(Timepicker.prototype, {
437436
},
438437

439438
//########################################################################
440-
// when a slider moves...
439+
// when a slider moves, set the internal time...
441440
// on time change is also called when the time is updated in the text field
442441
//########################################################################
443442
_onTimeChange: function() {
@@ -597,16 +596,7 @@ $.datepicker._updateDatepicker = function(inst) {
597596
if (typeof(inst.stay_open) !== 'boolean' || inst.stay_open === false) {
598597
this._base_updateDatepicker(inst);
599598
// Reload the time control when changing something in the input text field.
600-
this._beforeShow(inst.input, inst);
601-
}
602-
};
603-
604-
$.datepicker._beforeShow = function(input, inst) {
605-
var beforeShow = this._get(inst, 'beforeShow');
606-
if (beforeShow) {
607-
inst.stay_open = true;
608-
beforeShow.apply((inst.input ? inst.input[0] : null), [inst.input, inst]);
609-
inst.stay_open = false;
599+
this._get(inst, 'timepicker')._addTimePicker();
610600
}
611601
};
612602

@@ -726,12 +716,8 @@ $.datepicker._setTimeDatepicker = function(target, date, withDate) {
726716
//#######################################################################################
727717
$.datepicker._base_setDateDatepicker = $.datepicker._setDateDatepicker;
728718
$.datepicker._setDateDatepicker = function(target, date) {
729-
var inst = this._getInst(target),
730-
tp_date = new Date(date.getTime());
731-
732-
this._updateDatepicker(inst);
733719
this._base_setDateDatepicker.apply(this, arguments);
734-
this._setTimeDatepicker(target, tp_date, true);
720+
this._setTimeDatepicker(target, date, true);
735721
};
736722

737723
//#######################################################################################

0 commit comments

Comments
 (0)