Nodejs Year Leap Check isLeapYear(year)

Here you can find the source of isLeapYear(year)

Method Source Code

/**/*w w  w.j ava2s. com*/
 * Checks if given year is a leap year
 * @param {int} year
 * @return {boolean}
 */

Date.isLeapYear = function(year) {
  return (((year % 4 === 0) && (year % 100 !== 0)) || (year % 400 === 0));
};

Related

  1. isLeapYear()
    Date.prototype.isLeapYear = function(){
      return (0==this.getYear()%4 && ((this.getYear()%100 != 0) || (this.getYear()%400 == 0))); 
    
  2. isLeapYear()
    Date.prototype.isLeapYear = function () {
        var year = this.getFullYear();
        return ((year & 3) == 0 && (year % 100 || (year % 400 == 0 && year)));
    
  3. isLeapYear()
    Date.prototype.isLeapYear = function () {
      return new Date(this.getFullYear(), 1, 29).getDate() == 29;
    };
    
  4. isLeapYear()
    Date.prototype.isLeapYear = function() {
      return Date.isLeapYear(this.getFullYear());
    };
    
  5. isLeapYear()
    Date.prototype.isLeapYear = function ()
        var y = this.getFullYear();
        return (((y % 4 === 0) && (y % 100 !== 0)) || (y % 400 === 0));
    };
    
  6. isLeapYear(year)
    Date.isLeapYear = function (year)
        return (((year % 4 === 0) && (year % 100 !== 0)) || (year % 400 === 0));
    };
    
  7. isLeapYear(year)
    function {
      return year%4==0&&(year%100!=0||year%400==0);