rubinius/rubinius — pull request #2350 by teleological (2013-05-16 17:17:17+00:00)
Title: Fix issues affecting dates before 1902, after 2037

Fixed off-by-one in calls to Sakamoto day-of-week function. This bug caused miscalculations for some dates before 1902 and after 2037. Fixing this bug caused another spec to fail, revealing a secondary issue in timestamp64 where a leap day was being skipped in the calculation of epoch seconds for a date in 1801. Fixed that, too.

Revised Ruby 1.9 Time#to_date to use logic like MRI > 1.8, which assumes a proleptic Gregorian calendar when converting the value. Current implementation is based on MRI's private Time#to_date, which has different behavior.

With these changes, newly added failing rubyspecs in core/time ("pre-Gregorian reform dates" via Time#gm, Time#utc) pass for -X18 and -X19. Newly added failing rubyspecs in library/time/to_date ("pre-Gregorian" and "Julian-Gregorian gap", -X19 only) also pass.