Added date manipulation logic and tests