Skip to content

Commit ceabba8

Browse files
committed
Merge remote-tracking branch 'trentrichardson/dev' into iso8601-tz
2 parents 6737b60 + 8507859 commit ceabba8

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

jquery-ui-timepicker-addon.js

+11-1
Original file line numberDiff line numberDiff line change
@@ -1017,7 +1017,17 @@ $.datepicker._gotoToday = function(id) {
10171017
var inst = this._getInst($(id)[0]),
10181018
$dp = inst.dpDiv;
10191019
this._base_gotoToday(id);
1020-
this._setTime(this._getInst($(id)[0]), new Date());
1020+
var now = new Date();
1021+
var tp_inst = this._get(inst, 'timepicker');
1022+
if (tp_inst._defaults.showTimezone && tp_inst.timezone_select) {
1023+
var tzoffset = now.getTimezoneOffset(); // If +0100, returns -60
1024+
var tzsign = tzoffset > 0 ? '-' : '+';
1025+
tzoffset = Math.abs(tzoffset);
1026+
var tzmin = tzoffset % 60
1027+
tzoffset = tzsign + ('0' + (tzoffset - tzmin) / 60).slice(-2) + ('0' + tzmin).slice(-2);
1028+
tp_inst.timezone_select.val(tzoffset);
1029+
}
1030+
this._setTime(inst, now);
10211031
$( '.ui-datepicker-today', $dp).click();
10221032
};
10231033

0 commit comments

Comments
 (0)