Change date calculation logic