Javascript function for validating date


But my problem is that my date looks like 01-jan-2000how to compare today month like 06 with jan. Uses Java Script's built-in Date to test if the date is valid, and therefore does no sanity checks.

javascript function for validating date-59javascript function for validating date-75

They are each validated seperately and combined together.

We have also provided the javascript date validation for the dd/mm/yyyy format.

If the valid date character is changed please make sure you replace it in the HTML and Javascript code too.

moment("2010-10-319", ["YYYY-MM-DD"])Valid() // true moment("2010-10-31a", ["YYYY-MM-DD"])Valid(); // true moment("2010-10-319", ["MM/DD/YYYY", "MM-DD-YYYY", "YYYY-MM-DD"])Valid(); // true moment("20", ["MM/DD/YYYY", "MM-DD-YYYY", "YYYY-MM-DD"])Valid(); // false (!!!

) moment("2010-10-319qr", ["MM/DD/YYYY", "MM-DD-YYYY", "YYYY-MM-DD"])Valid(); // true (! Moment defaults to permissive parsing, meaning extraneous characters are ignored.

Validation can be defined by many different methods, and deployed in many different ways.

You must have an account to comment. Please register or login here!