Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Except for every 400th year.


how about this?

        leap = function(x) { 
          if ((x % 4) != 0) {
            return 0;
          }
          return Number(
            (x % 100) != 0 || (x % 400) == 0
          );
        }

        function(x) { return 28 + leap(x) + (...) };




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: