From e96f726b82da575522ec6718a49a6ede27f009d8 Mon Sep 17 00:00:00 2001 From: Matthias Althaus Date: Fri, 9 Aug 2013 11:33:12 +0200 Subject: [PATCH 1/2] Fixes enable/disable timepicker Due to the fact that each datetimepicker instance has its own settings these have to be updated accordingly on enable or disable. --- src/jquery-ui-timepicker-addon.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/jquery-ui-timepicker-addon.js b/src/jquery-ui-timepicker-addon.js index 31b7a52..d7ad2bd 100644 --- a/src/jquery-ui-timepicker-addon.js +++ b/src/jquery-ui-timepicker-addon.js @@ -1485,6 +1485,7 @@ var tp_inst = this._get(inst, 'timepicker'); $(target).datepicker('getDate'); // Init selected[Year|Month|Day] if (tp_inst) { + inst.settings.showTimepicker = false; tp_inst._defaults.showTimepicker = false; tp_inst._updateDateTime(inst); } @@ -1499,6 +1500,7 @@ var tp_inst = this._get(inst, 'timepicker'); $(target).datepicker('getDate'); // Init selected[Year|Month|Day] if (tp_inst) { + inst.settings.showTimepicker = true; tp_inst._defaults.showTimepicker = true; tp_inst._addTimePicker(inst); // Could be disabled on page load tp_inst._updateDateTime(inst); From bc166e45e35fa89ee53a502dfe9d4a09d88567ab Mon Sep 17 00:00:00 2001 From: Matthias Althaus Date: Fri, 9 Aug 2013 12:52:06 +0200 Subject: [PATCH 2/2] Fixed exception thrown by onTimeChange After disabling a timepicker an exception is thrown, if you close the now timepicker-less datepicker. --- src/jquery-ui-timepicker-addon.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/jquery-ui-timepicker-addon.js b/src/jquery-ui-timepicker-addon.js index d7ad2bd..484ada9 100644 --- a/src/jquery-ui-timepicker-addon.js +++ b/src/jquery-ui-timepicker-addon.js @@ -702,6 +702,9 @@ * on time change is also called when the time is updated in the text field */ _onTimeChange: function () { + if (!this._defaults.showTimepicker) { + return; + } var hour = (this.hour_slider) ? this.control.value(this, this.hour_slider, 'hour') : false, minute = (this.minute_slider) ? this.control.value(this, this.minute_slider, 'minute') : false, second = (this.second_slider) ? this.control.value(this, this.second_slider, 'second') : false,