Repository navigation
Honor PREFER_DATES_FROM for date_formats with a month but no year - #1399
Open
AdrianAtZyte wants to merge 5 commits into
Open
AdrianAtZyte wants to merge 5 commits into
AdrianAtZyte wants to merge 5 commits into
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #1399 +/- ##
==========================================
+ Coverage 99.18% 99.28% +0.10%
==========================================
Files 239 239
Lines 4030 4060 +30
==========================================
+ Hits 3997 4031 +34
+ Misses 33 29 -4 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
AdrianAtZyte
marked this pull request as ready for review
September 23, 2026 07:34
serhii73
reviewed
Oct 20, 2026
serhii73
left a comment
Collaborator
There was a problem hiding this comment.
Code review (claude code-review, at f26560f). Not approving as is, there is a regression in a common case:
- Today is pushed a year ahead. The year shift compares a midnight-truncated date with
now, which still has its time of day. WithRELATIVE_BASE=2026-06-15 10:00, format%B %d, inputJune 15andPREFER_DATES_FROM='future', the result is 2027-06-15; before this PR it was 2026-06-15. The comparison needs date granularity, or an equal date should be exempt. - Month-only formats depend on an arbitrary day. For
%Band inputJunewith base 2026-06-15,'past'gives 2025-06-20 and'future'gives 2026-06-20, becauseset_correct_day_from_settingsfills in a day first. A month-only input should be compared by month. - Day-only and month-less formats are skipped.
%dwith input10,'future'and base 2026-06-15 still returns 2026-06-10, and%H:%Mis also left alone, so the setting behaves differently for%d %Band for%dor%H:%M.test_prefer_dates_from_with_monthless_date_formatsonly assertsyear == 2026, so it locks in "no preference" instead of checking the date. - Behaviour change for existing users. Anyone using
PREFER_DATES_FROMwith year-lessdate_formatsnow gets a different year. That needs a docs or changelog entry, and boundary tests (same day, a later time of day, a leap-year base).
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Closes #1350