Fix a problem where trying to generate a calendar for December would fail due to infinite looping