You are using dates before October 15, 1582. The Gregorian calendar was adopted on this date, so dates before this may not be historically accurate.
The day-of-week calculation will still work mathematically, but may not reflect actual historical days.