zorin-e
4/5/2017 - 10:37 AM

Date format as prototype class Date

Date format as prototype class Date

Date.prototype.dateFormat = function() {
    var landingNull = function(value, month) {
        return ('0' + (month ? value + 1 : value).toString()).slice(-2);
    };

    return this.getFullYear() + '-' + landingNull(this.getMonth(), true) + '-' + landingNull(this.getDate());
};