I just added a link to the code with a brief comment. Basically, it simplifies the leap year date calculation. If February is the last month of the year, then the possibly-existing leap day is the last day of the year. If you do it the normal way your calculations for March through December need to know whether February is a leap year. Now none of that is needed. You don’t even need explicit code to calculate whether a given year is a leap year: it’s implicit in the constants 146097, 36524, and 1461.
IIRC, it's also why the leap day was set to Feb 29th in the first place. At the time (romans?) the year started March 1st.
In case someone was wondering why in the world someone said we should add a day to the second month of the year...
The magic numbers at the end of this explanation are the number of days of each part of the leap year cycle:
146097 days = 400 year portion of the leap year cycles (including leap years during that)
36524 days = same for the 100 year portion of the leap year cycles
1461 days = 4 year cycle + 1 leap day