-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
date: Adds support for datetime for parameter -d #5181
Conversation
8d25370
to
c2e348e
Compare
Cool! I don't think we need 2 variants. Basically |
@tertsdiepraam thank you for your comment, would you recommend to change parse_datetime so it accepts relative time? I can do that, just want to confirm first. |
In theory yes, but there's a lot happening there already. Let's start here to get the issue fixed and look at getting that change to parse_datetime later. Does that sound good? |
@tertsdiepraam okay, so you want me to fix the comments by the bot for now only? |
Hmmm, actually you're right. I didn't think this through. Yes, parse_datetime should do both absolute and relative in one function. Sorry for the confusion :) |
@tertsdiepraam okay no problem. Thanks for clarification. |
bfcd05e
to
bbf95cf
Compare
This resolved issue uutils#5177. The PR adds a new enum HumanDuration(Duration), HumanDateTime(DateTime<FixedOffset>) and uses parse_datetime::parse_datetime::from_str to support datetime if relative time cannot be parsed. Furthermore tests are added for tests/by-util/test_date.rs.
bbf95cf
to
f95e42a
Compare
Looks like touch is failing because the new |
No activity for a while, closing! Feel free to reopen when ready |
This resolves issue #5177.
The PR adds a new enum HumanDuration(Duration), HumanDateTime(DateTime) and uses parse_datetime::parse_datetime::from_str to support datetime if relative time cannot be parsed.
For example we can now parse
date -d "@0"
,date -d "1992-02-12"
anddate -d "2012-01-01 14:00"
.Furthermore tests are added for tests/by-util/test_date.rs.