diff options
author | Jun Omae <jun66j5@gmail.com> | 2011-08-11 15:55:47 +0900 |
---|---|---|
committer | Jun Omae <jun66j5@gmail.com> | 2011-08-11 15:55:47 +0900 |
commit | 5ab6e7bc7dd22b4c5704c6c4eb1af498a0627241 (patch) | |
tree | 145dbe7035040560894a131a8043e984ab8bd7d2 /jquery-ui-timepicker-addon.js | |
parent | 04efa5859c47725c9547b2825c248a102fa64e5b (diff) | |
download | jQuery-Timepicker-Addon-5ab6e7bc7dd22b4c5704c6c4eb1af498a0627241.zip jQuery-Timepicker-Addon-5ab6e7bc7dd22b4c5704c6c4eb1af498a0627241.tar.gz jQuery-Timepicker-Addon-5ab6e7bc7dd22b4c5704c6c4eb1af498a0627241.tar.bz2 |
Now button sets the current timezone.
Diffstat (limited to 'jquery-ui-timepicker-addon.js')
-rw-r--r-- | jquery-ui-timepicker-addon.js | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/jquery-ui-timepicker-addon.js b/jquery-ui-timepicker-addon.js index 1b17233..6973632 100644 --- a/jquery-ui-timepicker-addon.js +++ b/jquery-ui-timepicker-addon.js @@ -989,7 +989,17 @@ $.datepicker._gotoToday = function(id) { var inst = this._getInst($(id)[0]), $dp = inst.dpDiv; this._base_gotoToday(id); - this._setTime(this._getInst($(id)[0]), new Date()); + var now = new Date(); + var tp_inst = this._get(inst, 'timepicker'); + if (tp_inst.timezone_select) { + var tzoffset = now.getTimezoneOffset(); // If +0100, returns -60 + var tzsign = tzoffset > 0 ? '-' : '+'; + tzoffset = Math.abs(tzoffset); + var tzmin = tzoffset % 60 + tzoffset = tzsign + ('0' + (tzoffset - tzmin) / 60).slice(-2) + ('0' + tzmin).slice(-2); + tp_inst.timezone_select.val(tzoffset); + } + this._setTime(inst, now); $( '.ui-datepicker-today', $dp).click(); }; |