For implementing the Calendar classes I used the algorithms from the book "Calendrical Calculations" by Nachum Dershowitz and Edward M. Rheingold, second reprint 1998. Trying to prevent the introduction of new bugs, I implemented their algorithms in the N:CalendricalCalculations namespace and wrapped it in the calendar classes.
The fixed day number is also known as R.D. - rata die. Midnight at the onset of Monday, January 1, year 1 (Gregorian) is R.D. 1.
Here are all my references: