WCF.Date.Time now only supports past dates
authorAlexander Ebert <ebert@woltlab.com>
Tue, 16 Apr 2013 17:48:43 +0000 (19:48 +0200)
committerAlexander Ebert <ebert@woltlab.com>
Tue, 16 Apr 2013 17:48:43 +0000 (19:48 +0200)
Every date which is in the future will be displayed as "1 Minute Ago"

wcfsetup/install/files/js/WCF.js

index 31ba173c44d5c47dcf166848e92df3db9b69ab11..313fc67e07cb96f210d7126b570622b817c066f5 100755 (executable)
@@ -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