calendarProvider: simplify code and avoid division by zero.
Simplify code, reducing the binary size.