From: Alexander Ebert Date: Tue, 16 Apr 2013 17:48:43 +0000 (+0200) Subject: WCF.Date.Time now only supports past dates X-Git-Tag: 2.0.0_Beta_1~336^2~1 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=69948aa53a9d6cff32fabc41a1520fdaad09411a;p=GitHub%2FWoltLab%2FWCF.git WCF.Date.Time now only supports past dates Every date which is in the future will be displayed as "1 Minute Ago" --- diff --git a/wcfsetup/install/files/js/WCF.js b/wcfsetup/install/files/js/WCF.js index 31ba173c44..313fc67e07 100755 --- a/wcfsetup/install/files/js/WCF.js +++ b/wcfsetup/install/files/js/WCF.js @@ -2363,14 +2363,9 @@ WCF.Date.Time = Class.extend({ var $time = $element.data('time'); var $offset = $element.data('offset'); - // timestamp is in the future - if ($timestamp > this._timestamp) { - var $string = WCF.Language.get('wcf.date.dateTimeFormat'); - $element.text($string.replace(/\%date\%/, $date).replace(/\%time\%/, $time)); - } // timestamp is less than 60 minutes ago (display 1 hour ago rather than 60 minutes ago) - else if (this._timestamp < ($timestamp + 3540)) { - var $minutes = Math.round((this._timestamp - $timestamp) / 60); + if ($timestamp >= this._timestamp || this._timestamp < ($timestamp + 3540)) { + var $minutes = Math.max(Math.round((this._timestamp - $timestamp) / 60), 1); $element.text(eval(WCF.Language.get('wcf.date.relative.minutes'))); } // timestamp is less than 24 hours ago