Conversation
…from/--to are given.
There was a problem hiding this comment.
Pull Request Overview
Adds natural-language time range handling to the CLI by introducing a --time-span option and support for "ago" in relative datetime parsing, with --to defaulting to now.
- Introduce --time-span for natural language ranges (e.g., "3 hours ago")
- Add iso_to_datetime to standardize and parse ISO8601 inputs
- Default --to to the current time and compute --from when omitted
Reviewed Changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| setup.py | Bump package version to 1.0.3-1 |
| pyproject.toml | Bump project version to 1.0.3-1 |
| main/tests/test_datetime.py | Add tests for parse_dt supporting "ago" |
| main/scripts/get.py | Implement time range defaults and parsing using iso_to_datetime/parse_dt |
| main/data/utils.py | Add iso_to_datetime and extend parse_dt to handle "ago" |
| main/data/init.py | Export iso_to_datetime |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
main/scripts/get.py
Outdated
| t_now_o, t_now = standardize_datetime(datetime_with_timezone(datetime.now())) | ||
|
|
||
| # | ||
| time_span = args.time_span + "before" |
There was a problem hiding this comment.
Missing space before 'before' yields strings like '6 hoursbefore'. While parse_dt strips markers, this is brittle. Use a spaced concat: time_span = f"{args.time_span} before".
| time_span = args.time_span + "before" | |
| time_span = f"{args.time_span} before" |
| def iso_to_datetime(s: str) -> tuple[datetime, str]: | ||
| """ Parse a ISO8601 string into a datetime object with ZoneInfo. |
There was a problem hiding this comment.
The docstring mentions returning a datetime object, but the function returns a (datetime, iso_string) tuple normalized to UTC. Update the docstring to document the tuple return and UTC normalization.
Use natural English define the time range vs the to time (defaults to now)