Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
While trying to get the rest of the TODO date formats to work I found a bug with the previous week based date handling. If we were given a date like Date.strptime('2006 23 0', '%Y %U %w') our code would come up with 2006/6/11. But it is actually 2006/6/4
The problem is that we were trying to use Date.commercial for everything but some weeks a given sunday based date isn't even in the same week as the monday based weeks that Date.commercial uses. See below. 6/4 is in the 22nd commercial week but 23rd non-commercial
I'm proposing this alternative implementation where we delegate to the unmocked strptime but pass it a fully qualified date string that is populated from our mocked time where appropriate. This is now working for all the TODO date formats. I'm not crazy about this implementation since it feels icky to have this one scenario where we are using strptime to compute the new date. Without having something like Date.non_commercial that takes the sunday based weeks I'm not sure what else to do.