JavaScript Coder

date validation

JavaScript Form Validation - Date

It may be tempting to validate date input using regular expressions. However, the better alternative will be to actually convert the date to a date object and test it. For example, a simple regular expression test would approve this date: 2011/02/29 perfectly valid but there is no such date (since 2011 was not a leap year) Validate dates in the format: MM/DD/YYYY (or MM-DD-YYYY or MM.DD.YYYY ) function validateDate_MMDDYYYY(input_date) { var parts = input_date.

Continue Reading →