-
Notifications
You must be signed in to change notification settings - Fork 23
Parse relative weekdays like "next monday" #128
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds support for parsing relative weekdays (e.g. "next monday") in human-readable time strings, fixing related issues and enabling GNU test cases to pass. Key changes include extending the regex pattern to capture weekday strings, introducing the adjust_for_weekday helper function for calculating the correct date, and adding comprehensive tests for "this", "last", "next", and numbered weekday specifications.
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
File | Description |
---|---|
src/parse_relative_time.rs | Updated regex and parsing logic to capture weekday inputs and added tests for relative weekday manipulations |
Cargo.toml | Bumped version from 0.8.0 to 0.9.0 to reflect the new feature |
it is now conflicting, could you please rebase it? thanks |
33d0670
to
acf250a
Compare
acf250a
to
65fb914
Compare
Yes, no problem. Rebased. BTW I noticed a case I missed before, so fixed it and added more tests. The case is when using weekdays, GNU date truncates the time to midnight. This output is with parse_datetime from this PR:
Confirmed unit tests for parse_datetime and coreutils pass, and GNU test |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #128 +/- ##
===========================
===========================
☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Thanks! |
@@ -1,7 +1,7 @@ | |||
[package] | |||
name = "parse_datetime" | |||
description = "parsing human-readable time strings and converting them to a DateTime" | |||
version = "0.8.0" | |||
version = "0.9.0" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i wish that was done with a different commit message and a different PR
i missed it, sorry
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry I wasn't sure whether to bump it or let someone else
Fixes #127 and uutils/coreutils#7662. Enables GNU test
tests/date/date-next-dow.pl
to pass:Note, this also allows some formats that GNU date doesn't accept, but I think they're reasonable: