refactor tests and solution to take a date object as an argument