Skip to content

Commit

Permalink
Fix issue 15: "Week calculation is wrong ... includes decimals"
Browse files Browse the repository at this point in the history
According to the updated article,
http://techblog.procurios.nl/k/n618/news/view/33796/14863/calculate-iso-8601-week-and-year-in-javascript.html
either ceil or floor is needed. Choosing to use floor to keep the +1.
  • Loading branch information
Brien Coffield committed Aug 5, 2013
1 parent d0a752c commit 84f29cb
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/dateformat.js
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ var dateFormat = function () {


// Number of weeks between target Thursday and first Thursday // Number of weeks between target Thursday and first Thursday
var weekDiff = (targetThursday - firstThursday) / (86400000*7); var weekDiff = (targetThursday - firstThursday) / (86400000*7);
return 1 + weekDiff; return 1 + Math.floor(weekDiff);
}, },


/** /**
Expand Down

0 comments on commit 84f29cb

Please sign in to comment.