refactoring of the days calculation.