parse-date: more thorough checking of the validity of dates.