Skip to content

Commit 96dee33

Browse files
Merge pull request trentrichardson#380 from kdeng/dev
fixed a bug. When the input field is empty, and the date picker will never update it with the newly selected value
2 parents a64f781 + ee59b4c commit 96dee33

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

jquery-ui-timepicker-addon.js

+6-3
Original file line numberDiff line numberDiff line change
@@ -827,9 +827,12 @@ $.extend(Timepicker.prototype, {
827827
timeAvailable = dt !== null && this.timeDefined;
828828
this.formattedDate = $.datepicker.formatDate(dateFmt, (dt === null ? new Date() : dt), formatCfg);
829829
var formattedDateTime = this.formattedDate;
830-
if (dp_inst.lastVal !== undefined && (dp_inst.lastVal.length > 0 && this.$input.val().length === 0)) {
831-
return;
832-
}
830+
// remove following lines to force every changes in date picker to change the input value
831+
// Bug descriptions: when an input field has a default value, and click on the field to pop up the date picker.
832+
// If the user manually empty the value in the input field, the date picker will never change selected value.
833+
//if (dp_inst.lastVal !== undefined && (dp_inst.lastVal.length > 0 && this.$input.val().length === 0)) {
834+
// return;
835+
//}
833836

834837
if (this._defaults.timeOnly === true) {
835838
formattedDateTime = this.formattedTime;

0 commit comments

Comments
 (0)