From 92f1508c68b45d377c71974081ecdc03aa0a4e6e Mon Sep 17 00:00:00 2001 From: Trent Richardson Date: Thu, 18 Nov 2010 14:45:26 -0500 Subject: [PATCH] Fixed daylight savings bug i think --- jquery-ui-timepicker-addon.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/jquery-ui-timepicker-addon.js b/jquery-ui-timepicker-addon.js index 84933fd..cea3e01 100644 --- a/jquery-ui-timepicker-addon.js +++ b/jquery-ui-timepicker-addon.js @@ -675,6 +675,15 @@ $.datepicker._setTime = function(inst, date) { } }; +//####################################################################################### +// datepicker doesn't care about hours.. we do.. leave dp alone this time.. +//####################################################################################### +$.datepicker._daylightSavingAdjustDateTime = function(date) { + if (!date) return null; + date.setHours(date.getHours() > 12 ? date.getHours() + 2 : date.getHours()); + return date; +}; + //####################################################################################### // override setDate() to allow getting time too within Date object //####################################################################################### @@ -698,7 +707,7 @@ $.datepicker._getDate = function(inst) { if (tp_inst) return startDate = (!inst.currentYear || (inst.input && inst.input.val() == '')) ? null : - this._daylightSavingAdjust(new Date(inst.currentYear, inst.currentMonth, inst.currentDay, tp_inst.hour, tp_inst.minute, tp_inst.second)); + this._daylightSavingAdjustDateTime(new Date(inst.currentYear, inst.currentMonth, inst.currentDay, tp_inst.hour, tp_inst.minute, tp_inst.second)); else return $.datepicker._base_getDate(inst); };