Validating the format could be something like:
function isValidDateFormat(s) {
return /^\d\d-\d\d-\d\d\d\d$/.test(s);
}
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:
// Expects date in US-specific mm-dd-yyyy or
// mm/dd/yyyy format
function isValidDate(d) {
var bits = d.split(/[-/]/);
var date = new Date(bits[2] + '/'
+ bits[0] + '/'
+ bits[1]);
return date && (date.getMonth()+1) == bits[0]
&& date.getDate() == bits[1];
}
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.