Skip to content
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

Parse reference datetime and timedelta from the same string #110

Merged
merged 3 commits into from
Feb 16, 2025

Conversation

jfinkels
Copy link
Contributor

@jfinkels jfinkels commented Jan 31, 2025

Change the parse_datetime() function so that it parses both a
reference date and a time delta from one string. The new implementation
attempts to parse the datetime from the longest possible prefix of the
string. The remainder of the string is parsed as the time delta. This
allows us to parse more combinations of reference dates and time deltas
more easily.

Fixes #104

@jfinkels jfinkels force-pushed the parse-ref-date-and-delta branch from 805611a to 52e0546 Compare January 31, 2025 03:16
@jfinkels jfinkels changed the title [WIP] Parse reference datetime and timedelta from the same string Parse reference datetime and timedelta from the same string Jan 31, 2025
@jfinkels jfinkels marked this pull request as ready for review January 31, 2025 03:17
@cakebaker
Copy link
Collaborator

Great to see you also fixed the failing test_months and test_duration_parsing in parse_relative_time.rs :)

@jfinkels
Copy link
Contributor Author

jfinkels commented Feb 1, 2025

Sorry, I don't know how to interpret the "Basic CI / Run the fuzzers" job failure. Let me know if I should do anything about that.

@jfinkels
Copy link
Contributor Author

jfinkels commented Feb 8, 2025

I'll extract some of these changes into smaller pull requests.

@jfinkels
Copy link
Contributor Author

I'm still in the process of breaking this down into smaller changesets. A few more pull requests have been made.

Verified

This commit was signed with the committer’s verified signature.
iMichka Michka Popoff
Change the `parse_datetime()` function so that it parses both a
reference date and a time delta from one string. The new implementation
attempts to parse the datetime from the longest possible prefix of the
string. The remainder of the string is parsed as the time delta. This
allows us to parse more combinations of reference dates and time deltas
more easily.

Fixes uutils#104
@jfinkels jfinkels force-pushed the parse-ref-date-and-delta branch from e9f9b45 to 8aee979 Compare February 15, 2025 03:00
@jfinkels jfinkels marked this pull request as ready for review February 15, 2025 03:03
@jfinkels
Copy link
Contributor Author

Thanks for your patience. We've now merged quite a few smaller pull requests comprising changes extracted from this branch. I've now rebased on main and the smaller changeset should be easier to review now.

Co-authored-by: Daniel Hofstetter <daniel.hofstetter@42dh.com>
@cakebaker cakebaker merged commit e7a7a0b into uutils:main Feb 16, 2025
14 checks passed
Copy link

codecov bot commented Feb 16, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 0.00%. Comparing base (ca6a39c) to head (d4353d0).
Report is 4 commits behind head on main.

Additional details and impacted files
@@     Coverage Diff     @@
##   main   #110   +/-   ##
===========================
===========================

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@cakebaker
Copy link
Collaborator

Thanks for splitting it into multiple PRs, much appreciated :)

@jfinkels jfinkels deleted the parse-ref-date-and-delta branch February 16, 2025 16:32
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.

parse_datetime fails to parse a string comprising both reference date and a time delta
2 participants