Skip to content

Commit 3de1c5e

Browse files
Fixes trentrichardson#391 - Selecting input populates the date when empty
1 parent 8b95f20 commit 3de1c5e

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

jquery-ui-timepicker-addon.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -773,7 +773,7 @@ $.extend(Timepicker.prototype, {
773773
second != this.second || millisec != this.millisec ||
774774
(this.ampm.length > 0 &&
775775
(hour < 12) != ($.inArray(this.ampm.toUpperCase(), this.amNames) !== -1)) ||
776-
timezone != this.timezone);
776+
((this.timezone == null && timezone != this.defaultTimezone) || (this.timezone != null && timezone != this.timezone)));
777777

778778
if (hasChanged) {
779779

@@ -832,12 +832,13 @@ $.extend(Timepicker.prototype, {
832832
timeAvailable = dt !== null && this.timeDefined;
833833
this.formattedDate = $.datepicker.formatDate(dateFmt, (dt === null ? new Date() : dt), formatCfg);
834834
var formattedDateTime = this.formattedDate;
835+
835836
// remove following lines to force every changes in date picker to change the input value
836837
// Bug descriptions: when an input field has a default value, and click on the field to pop up the date picker.
837838
// If the user manually empty the value in the input field, the date picker will never change selected value.
838839
//if (dp_inst.lastVal !== undefined && (dp_inst.lastVal.length > 0 && this.$input.val().length === 0)) {
839840
// return;
840-
//}
841+
//}
841842

842843
if (this._defaults.timeOnly === true) {
843844
formattedDateTime = this.formattedTime;

0 commit comments

Comments
 (0)