Skip to content

Commit 454af7b

Browse files
committed
Reset time to defaults when .datepicker('setTime') is called with no arguments
1 parent f31d5ec commit 454af7b

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

jquery-ui-timepicker-addon.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -516,7 +516,6 @@ $.extend(Timepicker.prototype, {
516516
timeAvailable = dt !== null && this.timeDefined;
517517
this.formattedDate = $.datepicker.formatDate(dateFmt, (dt === null ? new Date() : dt), formatCfg);
518518
var formattedDateTime = this.formattedDate;
519-
520519
if (dp_inst.lastVal !== undefined && (dp_inst.lastVal.length > 0 && this.$input.val().length === 0))
521520
return;
522521

@@ -664,7 +663,6 @@ $.datepicker._gotoToday = function(id) {
664663
//#######################################################################################
665664
$.datepicker._setTime = function(inst, date) {
666665
var tp_inst = this._get(inst, 'timepicker');
667-
668666
if (tp_inst) {
669667
var defaults = tp_inst._defaults,
670668
// calling _setTime with no date sets time to defaults
@@ -687,7 +685,7 @@ $.datepicker._setTime = function(inst, date) {
687685
else tp_inst.second = second;
688686

689687
tp_inst._onTimeChange();
690-
tp_inst._updateDateTime();
688+
tp_inst._updateDateTime(inst);
691689
}
692690
};
693691

@@ -699,6 +697,7 @@ $.datepicker._setTimeDatepicker = function(target, date, withDate) {
699697
tp_inst = this._get(inst, 'timepicker');
700698

701699
if (tp_inst) {
700+
this._setDateFromField(inst);
702701
var tp_date;
703702
if (date) {
704703
if (typeof date == "string") {

0 commit comments

Comments
 (0)