Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow other "dates of calendar reform" in Date#strptime
Timecop is incompatible with the newest patch version of Psych (4.0.5) because of this change: https://github.com/ruby/psych/compare/v4.0.4..v4.0.5#diff-6a459e056cadf37665f54005bd2dde09d9ba8e66c9807eb0dc67145f9b841771L66-R66 Timecop only allows strptime to be called with the default of Date::ITALY as the fourth argument. This fourth argument is the "day of calendar reform" for leap years. Dates pre-reform are Julian calendar dates, which have leap years every 4 years. Dates after reform are Gregorian calendar dates, which have more complicated leap year logic (every 4 years, except if the year is divisible by 100 and not by 400). https://en.wikipedia.org/wiki/Gregorian_calendar Psych starts calling strptime with Date::GREGORIAN as of 4.0.5 (I'm not sure why, but it's a legal use of the standard Ruby API and so it seems like Timecop shouldn't break it). This PR updates strptime_without_mock_date to allow passing in other values for the fourth argument by passing them along to date initialization.
- Loading branch information