check date is valid