extend utils.ago to handle dates beyond 31 days

This commit is contained in:
Martin Zimmermann 2013-09-12 17:28:13 +02:00
parent 63f03e1111
commit 27ba6d795f

View File

@ -20,7 +20,7 @@ define({
var diff = (((new Date()).getTime() - date.getTime()) / 1000),
day_diff = Math.floor(diff / 86400);
if (isNaN(day_diff) || day_diff < 0 || day_diff >= 31)
if (isNaN(day_diff) || day_diff < 0)
return;
return day_diff == 0 && (
@ -31,7 +31,9 @@ define({
diff < 86400 && "vor " + Math.floor(diff / 3600) + " Stunden") ||
day_diff == 1 && "Gestern" ||
day_diff < 7 && "vor " + day_diff + " Tagen" ||
day_diff < 31 && "vor " + Math.ceil(day_diff / 7) + " Wochen";
day_diff < 31 && "vor " + Math.ceil(day_diff / 7) + " Wochen" ||
day_diff < 365 && "vor " + Math.ceil(day_diff / 30) + " Monaten" ||
"vor " + Math.ceil(day_diff / 365.25) + " Jahren";
},
heading: function() {