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

date: date setting format error #6398

Open
my4ng opened this issue May 13, 2024 · 1 comment
Open

date: date setting format error #6398

my4ng opened this issue May 13, 2024 · 1 comment
Labels

Comments

@my4ng
Copy link

my4ng commented May 13, 2024

The coreutils version currently uses the parse_datetime crate to parse the date source which parses in YYYYMMDDHHMM and similar formats. However it is not compliant with date:

Usage: date [OPTION]... [+FORMAT]
  or:  date [-u|--utc|--universal] [MMDDhhmm[[CC]YY][.ss]]
Display date and time in the given FORMAT.
With -s, or with [MMDDhhmm[[CC]YY][.ss]], set the date and time.

GNU:

$ date 11111111
Mon 11 Nov 2024 11:11:00 AEDT

coreutils

$ cargo run --release -p uu_date -- 11111111
target/release/date: invalid date '11111111'

Since it is interpreting the first 1111 as the year.

Note: date -s STRING is compliant with GNU the version, only the positional argument format is affected.

@RenjiSann
Copy link
Contributor

So from what I investigated, the program fails on this part of the code

I am not sure of what I say, but it looks like our implementation only supports

date [OPTION]... [+FORMAT]

and not

date [-u|--utc|--universal] [MMDDhhmm[[CC]YY][.ss]]

because the reason the program fails is that there is no + at the start of our 11111111 string.

So we'd need to fix that.

I also note that the +% format fails on coreutils, while it only prints a % in GNU.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants