-
-
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: format date to correct date format before parsing #6401
Conversation
GNU testsuite comparison:
|
After looking at the code, there is this snippet in the For some reasons (I may not have all the context about it), we add I could understand why parsing Maybe a workaround would be to add respectively This would require a change to the parse_datetime crate. |
You mean the bug is in parse datetime crate? @RenjiSann |
Yes, it most probably is. |
The following example isolates the bug being on the parsing of the last single digit. It has no issue parsing use parse_datetime::parse_datetime;
fn main() {
let one = parse_datetime("2001-01-04");
let two = parse_datetime("2001-1-04");
let three = parse_datetime("2001-01-4");
let four = parse_datetime("2001-1-4");
println!("Result:\n{:?}\n{:?}\n{:?}\n{:?}", one, two, three, four);
}
|
Here is a PR for the fix in |
Waiting for uutils/parse_datetime#76 to be released |
#6423 was merged, from what I am testing, this is fixed. Maybe we can still add tests to make sure there are no regressions afterwards ? @ahmadabd do you want to give it a shot ? You can take a look at the tests I added in |
@@ -222,6 +222,12 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> { | |||
// Iterate over all dates - whether it's a single date or a file. |
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.
please run rustfmt
please reopen when ready :) |
closes #6392