mirror of
https://github.com/morrisjs/morris.js.git
synced 2024-11-10 21:36:34 +01:00
Added extra comments to the Coffeescript to describe the calculations that are going on
This commit is contained in:
parent
6be7b1904c
commit
6fb708acea
@ -296,10 +296,13 @@ class Morris.Line
|
||||
year = parseInt(p[1], 10);
|
||||
y1 = new Date(year, 0, 1);
|
||||
y2 = new Date(year+1, 0, 1);
|
||||
# first thursday in year (ISO 8601 standard)
|
||||
if y1.getDay() isnt 4
|
||||
y1.setMonth(0, 1 + ((4 - y1.getDay()) + 7) % 7);
|
||||
# first thursday in following year
|
||||
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);
|
||||
parseInt(p[1], 10) + (parseInt(p[2], 10) - 1) / weeks;
|
||||
else if n
|
||||
|
Loading…
Reference in New Issue
Block a user