From 3af6487f44b3065be803922ab92fac8e72138203 Mon Sep 17 00:00:00 2001 From: Tom Morris Date: Thu, 12 Jan 2012 06:34:04 +0000 Subject: [PATCH] Fix negative number of weeks at year boundary git-svn-id: http://google-refine.googlecode.com/svn/trunk@2421 7d457c2a-affb-35e4-300a-418c747d4874 --- main/webapp/modules/core/scripts/util/misc.js | 1 + 1 file changed, 1 insertion(+) diff --git a/main/webapp/modules/core/scripts/util/misc.js b/main/webapp/modules/core/scripts/util/misc.js index fca1d5f1a..82df4b332 100644 --- a/main/webapp/modules/core/scripts/util/misc.js +++ b/main/webapp/modules/core/scripts/util/misc.js @@ -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();