Fix negative number of weeks at year boundary

git-svn-id: http://google-refine.googlecode.com/svn/trunk@2421 7d457c2a-affb-35e4-300a-418c747d4874
This commit is contained in:
Tom Morris 2012-01-12 06:34:04 +00:00
parent fa2e6fe608
commit 3af6487f44

View File

@ -70,6 +70,7 @@ function formatRelativeDate(d) {
return (diff <= 1) ? ("yesterday " + d.toString("h:mm tt")) : (diff + " days ago");
} else if (d.between(last_month, today)) {
var diff = Math.floor((today.getDayOfYear() - d.getDayOfYear()) / 7);
if (diff < 1) {diff += 52};
return (diff == 1) ? "a week ago" : diff.toFixed(0) + " weeks ago" ;
} else if (d.between(almost_last_year, today)) {
var diff = today.getMonth() - d.getMonth();