Closed scpike closed 1 year ago
Also reproduced with using psych >= 3.3.3 because changes was back-ported to psych: 3.x in https://github.com/ruby/psych/pull/573
Please merge and release :)
I was looking at this yesterday. Meant to update but I got sidetracked, thanks for bringing this up and making a PR. Tested locally and it works. Not sure why our GitHub actions didn't run all tests. Maybe a first time contributor restriction??
Thanks @joshuacronemeyer! Appreciate you taking the time to look into this.
You're welcome @scpike. Hey @johnnyshields we released. Thanks for the friendly nudge.
Timecop is incompatible with the newest patch version of Psych (4.0.5) because of this change.
Timecop only allows Date#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.