Skip to content

Commit 5ab6e7b

Browse files
committed
Now button sets the current timezone.
1 parent 04efa58 commit 5ab6e7b

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
@@ -989,7 +989,17 @@ $.datepicker._gotoToday = function(id) {
989989
var inst = this._getInst($(id)[0]),
990990
$dp = inst.dpDiv;
991991
this._base_gotoToday(id);
992-
this._setTime(this._getInst($(id)[0]), new Date());
992+
var now = new Date();
993+
var tp_inst = this._get(inst, 'timepicker');
994+
if (tp_inst.timezone_select) {
995+
var tzoffset = now.getTimezoneOffset(); // If +0100, returns -60
996+
var tzsign = tzoffset > 0 ? '-' : '+';
997+
tzoffset = Math.abs(tzoffset);
998+
var tzmin = tzoffset % 60
999+
tzoffset = tzsign + ('0' + (tzoffset - tzmin) / 60).slice(-2) + ('0' + tzmin).slice(-2);
1000+
tp_inst.timezone_select.val(tzoffset);
1001+
}
1002+
this._setTime(inst, now);
9931003
$( '.ui-datepicker-today', $dp).click();
9941004
};
9951005

0 commit comments

Comments
 (0)