Reset time to defaults when .datepicker('setTime') is called with no arguments

This commit is contained in:
doublerebel 2010-12-05 17:19:27 -08:00
parent f31d5ecbeb
commit 454af7bcf0

View file

@ -516,7 +516,6 @@ $.extend(Timepicker.prototype, {
timeAvailable = dt !== null && this.timeDefined; timeAvailable = dt !== null && this.timeDefined;
this.formattedDate = $.datepicker.formatDate(dateFmt, (dt === null ? new Date() : dt), formatCfg); this.formattedDate = $.datepicker.formatDate(dateFmt, (dt === null ? new Date() : dt), formatCfg);
var formattedDateTime = this.formattedDate; var formattedDateTime = this.formattedDate;
if (dp_inst.lastVal !== undefined && (dp_inst.lastVal.length > 0 && this.$input.val().length === 0)) if (dp_inst.lastVal !== undefined && (dp_inst.lastVal.length > 0 && this.$input.val().length === 0))
return; return;
@ -664,7 +663,6 @@ $.datepicker._gotoToday = function(id) {
//####################################################################################### //#######################################################################################
$.datepicker._setTime = function(inst, date) { $.datepicker._setTime = function(inst, date) {
var tp_inst = this._get(inst, 'timepicker'); var tp_inst = this._get(inst, 'timepicker');
if (tp_inst) { if (tp_inst) {
var defaults = tp_inst._defaults, var defaults = tp_inst._defaults,
// calling _setTime with no date sets time to defaults // calling _setTime with no date sets time to defaults
@ -687,7 +685,7 @@ $.datepicker._setTime = function(inst, date) {
else tp_inst.second = second; else tp_inst.second = second;
tp_inst._onTimeChange(); tp_inst._onTimeChange();
tp_inst._updateDateTime(); tp_inst._updateDateTime(inst);
} }
}; };
@ -699,6 +697,7 @@ $.datepicker._setTimeDatepicker = function(target, date, withDate) {
tp_inst = this._get(inst, 'timepicker'); tp_inst = this._get(inst, 'timepicker');
if (tp_inst) { if (tp_inst) {
this._setDateFromField(inst);
var tp_date; var tp_date;
if (date) { if (date) {
if (typeof date == "string") { if (typeof date == "string") {