From: Matthias Schmidt Date: Thu, 13 Jun 2013 09:14:11 +0000 (+0200) Subject: Fixes issue with relative dates in JS X-Git-Tag: 2.0.0_Beta_4~49^2~3 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=88ff183f77b19729eb190e214b56c89fb8a7ce29;p=GitHub%2FWoltLab%2FWCF.git Fixes issue with relative dates in JS --- diff --git a/wcfsetup/install/files/js/WCF.js b/wcfsetup/install/files/js/WCF.js index ccf76c519f..db67d0310b 100755 --- a/wcfsetup/install/files/js/WCF.js +++ b/wcfsetup/install/files/js/WCF.js @@ -2711,7 +2711,7 @@ WCF.Date.Util = { /** * Returns a Date object with precise offset (including timezone and local timezone). - * Parameter timestamp must be in miliseconds! + * Parameters timestamp and offset must be in miliseconds! * * @param integer timestamp * @param integer offset @@ -2719,9 +2719,9 @@ WCF.Date.Util = { */ getTimezoneDate: function(timestamp, offset) { var $date = new Date(timestamp); - var $localOffset = $date.getTimezoneOffset() * -1 * 60000; + var $localOffset = $date.getTimezoneOffset() * 60000; - return new Date((timestamp - $localOffset - offset)); + return new Date((timestamp + $localOffset + offset)); } }; @@ -2833,7 +2833,7 @@ WCF.Date.Time = Class.extend({ var $days = Math.ceil(($midnight / 1000 - $timestamp) / 86400); // get day of week - var $dateObj = WCF.Date.Util.getTimezoneDate(($timestamp * 1000), $offset); + var $dateObj = WCF.Date.Util.getTimezoneDate(($timestamp * 1000), $offset * 1000); var $dow = $dateObj.getDay(); var $day = WCF.Language.get('__days')[$dow];