Refactors calculation of nextFirstDay.