Skip to content

Commit 92f1508

Browse files
Fixed daylight savings bug i think
1 parent 48f17b1 commit 92f1508

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

jquery-ui-timepicker-addon.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -675,6 +675,15 @@ $.datepicker._setTime = function(inst, date) {
675675
}
676676
};
677677

678+
//#######################################################################################
679+
// datepicker doesn't care about hours.. we do.. leave dp alone this time..
680+
//#######################################################################################
681+
$.datepicker._daylightSavingAdjustDateTime = function(date) {
682+
if (!date) return null;
683+
date.setHours(date.getHours() > 12 ? date.getHours() + 2 : date.getHours());
684+
return date;
685+
};
686+
678687
//#######################################################################################
679688
// override setDate() to allow getting time too within Date object
680689
//#######################################################################################
@@ -698,7 +707,7 @@ $.datepicker._getDate = function(inst) {
698707
if (tp_inst)
699708
return startDate = (!inst.currentYear || (inst.input && inst.input.val() == '')) ?
700709
null :
701-
this._daylightSavingAdjust(new Date(inst.currentYear, inst.currentMonth, inst.currentDay, tp_inst.hour, tp_inst.minute, tp_inst.second));
710+
this._daylightSavingAdjustDateTime(new Date(inst.currentYear, inst.currentMonth, inst.currentDay, tp_inst.hour, tp_inst.minute, tp_inst.second));
702711
else return $.datepicker._base_getDate(inst);
703712
};
704713

0 commit comments

Comments
 (0)