I need sample javascript code to validate the date with mm-dd-yyyy format.
1) if user enters wrong date with respect to above date format.
2) Date range validations,start date and end date range validations.
Any help on this appreciated.
Regards,
Chaitu
Validating the format could be something like:
For date ranges, convert the string to a date object and compare it to date objects for the limits of the range.
Here’s a date validation function – no need to check the format of the input, if it’s wrong, the function returns false:
So now you have how to validate the format, how to validate a date and how to convert a string to a date object. Should be pretty simple to do the comparison from here.