Posted By

tomasdev on 06/13/11


Tagged

javascript date


Versions (?)

Leap Year Check


 / Published in: JavaScript
 

URL: http://www.tomasdev.com.ar

Extend Date object to have isLeapYear() boolean (true for Leap Years) Taken from https://raw.github.com/vitch/jquery-methods/master/date.js

  1. Date.prototype.isLeapYear = function() {
  2. var y = this.getFullYear();
  3. return (y%4==0 && y%100!=0) || y%400==0;
  4. };

Report this snippet  

You need to login to post a comment.