-
Notifications
You must be signed in to change notification settings - Fork 227
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Date.strptime doesn't work correctly today. #434
Comments
@mikdiet nice catch. This is a bug. |
@mikdiet are you interested in submitting a PR for this? The problem looks to be that at the end of the year we might need to return a date from next year but our code is always calling Date.strptime_without_mock_date with the current mocked year. I think the fix is going to be getting the year from the un-mocked method, computing the year offset of the mocked date and then adding it to the result of the un-mocked method. |
here is what i was thinking but I am not sure how to write a test for it. I think I need to mock the result of the unmocked time so that we can simulate what we're seeing today (last week of the year) #436 |
Ok, never mind that solution isn't quite right... I'll wait to hear if you are going to make a PR. If not I'll figure out how to write a test for this and go for there. |
hello @joshuacronemeyer - no, I wasn't intending to fix this myself. |
@joshuacronemeyer - first commit to this project, but I think I found a way to test / fix this scenario. |
In my test I have a line (added just 2 month ago) that used to work, but fails today.
It's not wrapped in any timecop helpers. Actually I could reproduce it in irb:
but original method works.
UPD: the actual string it tries to parse is
"2024 53 3"
- which corresponds to 32 December 🤣The text was updated successfully, but these errors were encountered: