Skip to content

Fix ytd and Z-suffix date parsing - #15

Open
MiguelBretas89 wants to merge 1 commit into
eddmann:mainfrom
MiguelBretas89:fix/ytd-and-z-suffix-parsing
Open

Fix ytd and Z-suffix date parsing#15
MiguelBretas89 wants to merge 1 commit into
eddmann:mainfrom
MiguelBretas89:fix/ytd-and-z-suffix-parsing

Conversation

@MiguelBretas89

Copy link
Copy Markdown

Summary

  • 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 ValueError.
  • 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.
  • Added tests/test_time_utils.py covering 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 locally
  • New tests reproduce both bugs against the pre-fix code and pass against the fix

This is my first open-source PR — happy to adjust anything to match project conventions.

- 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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant