uutils / uutils/coreutils

date: date setting format error

Open
#6,398 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

U - date
Dominant language
Rust
Stars
24.1k
Forks
2k
Avg merge
1d 5h
Merged PRs (30d)
365

Description

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.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the uu_date command's positional date-argument handling and inspect how the parse_datetime crate is used for that path. Compare the GNU positional format with the current behavior for 11111111, while preserving the existing date -s STRING behavior; done means this input is accepted in the expected month/day format.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
cli
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.