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.
As of the new year, we started seeing a test failure that I believe was caused by the intersection of:
20
is a potentially valid expiration year because you could continue typing and input2030
, which is valid)yearsFromNow
which optionally gives you the last 2 digits of a year (e.g. given the current year is 2025,yearsFromNow(-5, 2)
will give you"20"
as output)So, why did the test fail?
yearsFromNow(-5, 2)
returned"19"
, which is not a potentially valid prefix; the test captured this correctly. However, on January 1st 2025, the codeyearsFromNow(-5, 2)
returned"20"
, which is a potentially valid prefix, and the test that was expecting it to not be potentially valid, now fails.I wanted to make the fix be as unobtrusive as possible, so my preferred solution is to replace the test that was failing with 3 hard-coded tests that show the expected behavior of the year prefixes
"19"
,"20"
, and"21"
. This fixes the build with a small diff, and is a robust enough solution to be valid until 2081 when"21"
becomes a valid year prefix.