relative: accept hence after a relative time - #331
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #331 +/- ##
==========================================
+ Coverage 97.47% 97.48% +0.01%
==========================================
Files 21 21
Lines 4237 4258 +21
Branches 136 136
==========================================
+ Hits 4130 4151 +21
Misses 106 106
Partials 1 1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Warning
Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.
Copilot review overview
Review effort: Lite
Findings: 1
Open (1)
What changed in this PR
This PR extends relative datetime parsing to accept hence as a future-oriented suffix while preserving explicit signs, including fractional seconds.
Changes:
- Replaces the optional
agoparser with a direction parser supporting bothagoandhence. - Updates the relative-date grammar and README documentation.
- Adds tests covering suffix case folding, signed and fractional amounts, implicit amounts, ordinals, and invalid suffixes.
| File | Description |
|---|---|
src/lib.rs |
Adds coverage for hence parsing and invalid suffixes. |
src/items/relative.rs |
Parses ago and hence suffixes while applying the correct sign. |
src/items/mod.rs |
Updates the relative-date grammar documentation. |
README.md |
Documents hence as the future-relative suffix. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| direction, | ||
| ) | ||
| .verify_map(|(sign, (sec, nsec), _, ago)| { |

Accept hence after a relative unit without reversing its sign, including fractional seconds. Tests cover case folding, signed and zero amounts, implicit amounts, ordinals, and invalid suffixes.
Refs uutils/coreutils#14683; coreutils will need a release/dependency update to receive this parser fix.
Validation: 416 tests and 2 doctests passed; Clippy and rustfmt passed.
AI-assisted with Codex.