Permalink
Browse files

Fix leap year calculation

Years divisible by 400 *are* leap years (iow: 2/29/2000 was on Tuesday)
see: http://en.wikipedia.org/wiki/Leap_year#Algorithm
  • Loading branch information...
1 parent 195d649 commit 1ed1410739bb653c32ab5d0101e56401bf71f1d6 @pirxpilot pirxpilot committed Feb 17, 2013
Showing with 2 additions and 1 deletion.
  1. +2 −1 lib/days.js
View
3 lib/days.js
@@ -44,7 +44,8 @@ function daysInMonth(month, year) {
*/
function isLeapYear(year) {
- return ((0 == year % 4) && (0 != year % 100))
+ return (0 == year % 400)
+ || ((0 == year % 4) && (0 != year % 100))
|| (0 == year);
}

0 comments on commit 1ed1410

Please sign in to comment.