Repository navigation
Parse calendar quarters - #1417
Merged
Merged
Conversation
Codecov Reportβ
All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #1417 +/- ##
=======================================
Coverage 99.03% 99.04%
=======================================
Files 239 239
Lines 3853 3868 +15
=======================================
+ Hits 3816 3831 +15
Misses 37 37 β 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 11:31
serhii73
approved these changes
Oct 20, 2026
serhii73
left a comment
Collaborator
There was a problem hiding this comment.
Code review (claude code-review, at bcd52be; the first four items were run on this head). Standalone quarters work and I found no regression for inputs that parsed before. The main follow-up is to anchor the rewrite.
Non-blocking notes:
- The quarter regex only requires no word character on either side, and the substitution runs on the whole string.
parse('1 Q2 2025')returns 2025-01-04 (it becomes1 2025-04),parse('Q2 2025 and 3')returns 2025-04-03, andQ2 1530is read as the year 1530. All of these returned None on master. Applying the rewrite only when the quarter token is the whole date expression, and limiting the year to a plausible range, would avoid silently wrong dates. - The rewrite runs before locale selection, so
parse('2025Q2', languages=['ru'])still works and everyget_date_datacall pays an extra substitution; a cheap'q' in date_string.lower()guard would help. - "Current" for
PREFER_MONTH_OF_YEARtakesnowfromRELATIVE_BASE or datetime.now()and ignoresTIMEZONE, unlike the rest of the parser. period='quarter'is only patched onto the finalDateData, while_is_valid_date_dataandget_intersecting_periodsdon't know it, andpartsstill reports('year','month'). A string with several quarters (2025Q2 2025Q3) returns None.- Tests cover standalone quarters and three negative cases only. Please add embedded-token cases,
search_dates,languages,RETURN_TIME_SPANandTIMEZONE.
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.
Resolves #1254