Do date validation inside the date range function, and throw Validation error if not valid date.