Skip to content

Commit 9d86a29

Browse files
Merge pull request trentrichardson#623 from althaus/patch-1
Fixes enable/disable timepicker
2 parents a34caa8 + bc166e4 commit 9d86a29

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/jquery-ui-timepicker-addon.js

+5
Original file line numberDiff line numberDiff line change
@@ -702,6 +702,9 @@
702702
* on time change is also called when the time is updated in the text field
703703
*/
704704
_onTimeChange: function () {
705+
if (!this._defaults.showTimepicker) {
706+
return;
707+
}
705708
var hour = (this.hour_slider) ? this.control.value(this, this.hour_slider, 'hour') : false,
706709
minute = (this.minute_slider) ? this.control.value(this, this.minute_slider, 'minute') : false,
707710
second = (this.second_slider) ? this.control.value(this, this.second_slider, 'second') : false,
@@ -1485,6 +1488,7 @@
14851488
var tp_inst = this._get(inst, 'timepicker');
14861489
$(target).datepicker('getDate'); // Init selected[Year|Month|Day]
14871490
if (tp_inst) {
1491+
inst.settings.showTimepicker = false;
14881492
tp_inst._defaults.showTimepicker = false;
14891493
tp_inst._updateDateTime(inst);
14901494
}
@@ -1499,6 +1503,7 @@
14991503
var tp_inst = this._get(inst, 'timepicker');
15001504
$(target).datepicker('getDate'); // Init selected[Year|Month|Day]
15011505
if (tp_inst) {
1506+
inst.settings.showTimepicker = true;
15021507
tp_inst._defaults.showTimepicker = true;
15031508
tp_inst._addTimePicker(inst); // Could be disabled on page load
15041509
tp_inst._updateDateTime(inst);

0 commit comments

Comments
 (0)