Javascript validating dates from a form