check validity of date