Added tests and simplification for beforeDate and afterDate validations.