Added a validation for dates