From 88ff183f77b19729eb190e214b56c89fb8a7ce29 Mon Sep 17 00:00:00 2001 From: Matthias Schmidt Date: Thu, 13 Jun 2013 11:14:11 +0200 Subject: [PATCH] Fixes issue with relative dates in JS --- wcfsetup/install/files/js/WCF.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) 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]; -- 2.20.1