Refactor date validation