Add validation for date and datetime.