Skip to content

Commit aef1408

Browse files
committed
Set datepicker date from field before returning date for getDate method (Fixes Issue 44)
1 parent 3ca9079 commit aef1408

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

jquery-ui-timepicker-addon.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -728,10 +728,15 @@ $.datepicker._base_getDateDatepicker = $.datepicker._getDateDatepicker;
728728
$.datepicker._getDateDatepicker = function(target, noDefault) {
729729
var inst = this._getInst(target),
730730
tp_inst = this._get(inst, 'timepicker');
731-
if (tp_inst)
731+
732+
if (tp_inst) {
733+
this._setDateFromField(inst, noDefault);
734+
var date = this._getDate(inst);
735+
date.setHours(tp_inst.hour, tp_inst.minute, tp_inst.second);
732736
return (!inst.currentYear || (inst.input && inst.input.val() == '')) ?
733737
null :
734-
(new Date(inst.currentYear, inst.currentMonth, inst.currentDay, tp_inst.hour, tp_inst.minute, tp_inst.second));
738+
date;
739+
}
735740
else return this._base_getDateDatepicker(inst);
736741
};
737742

0 commit comments

Comments
 (0)