This sounds like exactly what I did.. an maybe just that I call the code a calendar.
Except that I have a lookup table of leap years and start the algorithm from the closest to current.
Actually, thinking again, it might have been dates known to be a Monday on the first day.