Date is Leap year - Node.js Date

Node.js examples for Date:Year

Description

Date is Leap year

Demo Code


Date.prototype.isLeap = function() {
    var y = this.getFullYear();
    if (y % 4 != 0) {
        return false;
    } else if (y % 400 == 0) {
        return true;
    } else if (y % 100 == 0) {
        return false;
    } else {//ww  w  . ja v  a2s.c  om
        return true; 
    }
};

Related Tutorials