Fixed bug where number of weeks was miscalculated

This commit is contained in:
Mark Abbott 2012-03-04 17:03:11 +00:00
parent 6fb708acea
commit b67c1b2358
3 changed files with 3 additions and 3 deletions

View File

@ -303,7 +303,7 @@ class Morris.Line
if y2.getDay() isnt 4
y2.setMonth(0, 1 + ((4 - y2.getDay()) + 7) % 7);
# Number of weeks between thursdays
weeks = 1 + Math.ceil((y2 - y1) / 604800000);
weeks = Math.ceil((y2 - y1) / 604800000);
parseInt(p[1], 10) + (parseInt(p[2], 10) - 1) / weeks;
else if n
parseInt(n[1], 10) + (parseInt(n[2], 10) - 1) / 12

View File

@ -328,7 +328,7 @@
y2 = new Date(year + 1, 0, 1);
if (y1.getDay() !== 4) y1.setMonth(0, 1 + ((4 - y1.getDay()) + 7) % 7);
if (y2.getDay() !== 4) y2.setMonth(0, 1 + ((4 - y2.getDay()) + 7) % 7);
weeks = 1 + Math.ceil((y2 - y1) / 604800000);
weeks = Math.ceil((y2 - y1) / 604800000);
return parseInt(p[1], 10) + (parseInt(p[2], 10) - 1) / weeks;
} else if (n) {
return parseInt(n[1], 10) + (parseInt(n[2], 10) - 1) / 12;

2
morris.min.js vendored

File diff suppressed because one or more lines are too long