Validate date value - Node.js Date

Node.js examples for Date:Date Calculation

Description

Validate date value

Demo Code

Validator.validateDate = function(date) {
    var exp = /(0[1-9]|[12][0-9]|3[01])[\/\-\.](0[1-9]|1[012])[\/\-\.](19|20)[0-9]{2}/;
    if (date.match(exp)) {
        return true;
    } else {/* w  ww  .j a  v a2  s  .  com*/
        return false;
    }
};

Related Tutorials