Fix ytd and Z-suffix date parsing - #15
Open
MiguelBretas89 wants to merge 1 commit into
Open
Conversation
- parse_time_range and get_range_description checked the generic "ends with d" relative-period branch before the "ytd" branch, so the documented "ytd" period was unreachable and always raised. - parse_date_string lowercased the input before replacing the ISO "Z" (UTC) suffix, so the replace never matched and Z-suffixed ISO datetimes always failed to parse. - Add tests/test_time_utils.py covering the module, which previously had no test coverage.
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.
Summary
parse_time_rangeandget_range_descriptionchecked the generic "ends withd" relative-period branch before theytdbranch, so the documentedytdperiod was unreachable and always raisedValueError.parse_date_stringlowercased the input before replacing the ISOZ(UTC) suffix, so the replace never matched andZ-suffixed ISO datetimes always failed to parse.tests/test_time_utils.pycovering the module, which previously had no test coverage (including regression tests for both fixes above).Test plan
make can-release(lint + pyright + full test suite) passes locallyThis is my first open-source PR — happy to adjust anything to match project conventions.