uutils / uutils/coreutils

gnucompability(date): Edge Cases (Part 3)

Open
#14,680 0 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

Hi, uutils mainteners

here is our new tests

relunsec@relunsec:~/software/coreutils/target/debug$ ./date $'+%___B1e'
September1e
relunsec@relunsec:~/software/coreutils/target/debug$ gnudate $'+%___B1e'
September1e
relunsec@relunsec:~/software/coreutils/target/debug$ ./date $'+%___+1e'
+18
relunsec@relunsec:~/software/coreutils/target/debug$ ./date $'+%___-1e'
18
relunsec@relunsec:~/software/coreutils/target/debug$ gnudate $'+%___-1e'
18
relunsec@relunsec:~/software/coreutils/target/debug$ ./date $'+%___+1e'
+18
relunsec@relunsec:~/software/coreutils/target/debug$ gnudate $'+%___+1e'
18
relunsec@relunsec:~/software/coreutils/target/debug$ 

Another parser confusion

relunsec@relunsec:~/software/coreutils/target/debug$ ./date $'+%:::A'
Friday
relunsec@relunsec:~/software/coreutils/target/debug$ gnudate $'+%:::A'
%:::A
relunsec@relunsec:~/software/coreutils/target/debug$ 

Also another test

relunsec@relunsec:~/software/coreutils/target/debug$ gnudate $'+%_-######A'
FRIDAY
relunsec@relunsec:~/software/coreutils/target/debug$ ./date $'+%_-######eA'
18A
relunsec@relunsec:~/software/coreutils/target/debug$ 

also with

relunsec@relunsec:~/software/coreutils/target/debug$ ./date  -d "month next month"
Wed Nov 18 10:54:02 AM EST 2026
relunsec@relunsec:~/software/coreutils/target/debug$ gnudate  -d "month next month"
Wed Nov 18 09:54:05 AM EST 2026
relunsec@relunsec:~/software/coreutils/target/debug$ 

same with

relunsec@relunsec:~/software/coreutils/target/debug$ ./date  -d "next hour EST"
Fri Sep 18 01:05:41 PM EDT 2026
relunsec@relunsec:~/software/coreutils/target/debug$ gnudate  -d "next hour EST"
gnudate: invalid date ‘next hour EST’
relunsec@relunsec:~/software/coreutils/target/debug$ 

another one

relunsec@relunsec:~/software/coreutils/target/debug$ ./date --debug -d "yesterday Fri Oct  2 11:10:59 AM EDT 2026"
date: input string: yesterday Fri Oct  2 11:10:59 AM EDT 2026
date: parsed date part: (Y-M-D) 2026-10-01
date: parsed time part: 11:10:59
date: input timezone: system default
Thu Oct  1 11:10:59 AM EDT 2026
relunsec@relunsec:~/software/coreutils/target/debug$ gnudate --debug -d "yesterday Fri Oct  2 11:10:59 AM EDT 2026"
date: parsed relative part: -1 day(s)
date: parsed day part: Fri (day ordinal=0 number=5)
date: parsed date part: (Y-M-D) 2026-10-02
date: parsed time part: 11:10:59
date: parsed local_zone part: isdst=1
date: parsed number part: 
date: input timezone: system default, dst
date: error: seen multiple time parts
gnudate: invalid date ‘yesterday Fri Oct  2 11:10:59 AM EDT 2026’
relunsec@relunsec:~/software/coreutils/target/debug$ 

Here is another example

relunsec@relunsec:~/software/coreutils/target/debug$ ./date --debug -d "next day last tuesday 12:00:00 EST next day"
date: input string: next day last tuesday 12:00:00 EST next day
date: parsed date part: (Y-M-D) 2026-09-17
date: parsed time part: 13:00:00
date: input timezone: system default
Thu Sep 17 01:00:00 PM EDT 2026
relunsec@relunsec:~/software/coreutils/target/debug$ gnudate --debug -d "next day last tuesday 12:00:00 EST next day"
date: parsed relative part: +1 day(s)
date: parsed day part: last Tue (day ordinal=-1 number=2)
date: parsed time part: 12:00:00
date: parsed local_zone part: isdst=0
date: parsed relative part: +2 day(s)
date: input timezone: system default
date: using specified time as starting value: '12:00:00'
date: error: invalid date/time value:
date:     user provided time: '(Y-M-D) 2026-09-18 12:00:00'
date:        normalized time: '(Y-M-D) 2026-09-18 13:00:00'
date:                                             --
date:      possible reasons:
date:        nonexistent due to daylight-saving time;
date:        numeric values overflow;
date:        missing timezone
gnudate: invalid date ‘next day last tuesday 12:00:00 EST next day’
relunsec@relunsec:~/software/coreutils/target/debug$ 

also with

relunsec@relunsec:~/software/coreutils/target/debug$ gnudate -d "2023-01-05 09:05:07" --debug +%c
date: parsed date part: (Y-M-D) 2023-01-05
date: parsed time part: 09:05:07
date: input timezone: system default
date: using specified time as starting value: '09:05:07'
date: starting date/time: '(Y-M-D) 2023-01-05 09:05:07'
date: '(Y-M-D) 2023-01-05 09:05:07' = 1672927507 epoch-seconds
date: timezone: system default
date: final: 1672927507.000000000 (epoch-seconds)
date: final: (Y-M-D) 2023-01-05 14:05:07 (UTC)
date: final: (Y-M-D) 2023-01-05 09:05:07 (UTC-05)
gnudate: output format: ‘%c’
Thu 05 Jan 2023 09:05:07 AM EST
relunsec@relunsec:~/software/coreutils/target/debug$ ./date -d "2023-01-05 09:05:07" --debug +%c
date: input string: 2023-01-05 09:05:07
date: parsed date part: (Y-M-D) 2023-01-05
date: parsed time part: 09:05:07
date: input timezone: system default
Thu Jan  5 09:05:07 2023
relunsec@relunsec:~/software/coreutils/target/debug$ 

also

relunsec@relunsec:~/software/coreutils/target/debug$ gnudate --debug -d "2023-01-01 12:00:00 + 1 day"
date: parsed date part: (Y-M-D) 2023-01-01
date: parsed time part: 12:00:00 UTC+01
date: parsed relative part: +1 day(s)
date: input timezone: parsed date/time string (+01)
date: using specified time as starting value: '12:00:00'
date: starting date/time: '(Y-M-D) 2023-01-01 12:00:00 TZ=+01'
date: after date adjustment (+0 years, +0 months, +1 days),
date:     new date/time = '(Y-M-D) 2023-01-02 12:00:00 TZ=+01'
date: '(Y-M-D) 2023-01-02 12:00:00 TZ=+01' = 1672657200 epoch-seconds
date: timezone: system default
date: final: 1672657200.000000000 (epoch-seconds)
date: final: (Y-M-D) 2023-01-02 11:00:00 (UTC)
date: final: (Y-M-D) 2023-01-02 06:00:00 (UTC-05)
gnudate: output format: ‘%a %b %e %r %Z %Y’
Mon Jan  2 06:00:00 AM EST 2023
relunsec@relunsec:~/software/coreutils/target/debug$ ./date --debug -d "2023-01-01 12:00:00 + 1 day"
date: input string: 2023-01-01 12:00:00 + 1 day
date: parsed date part: (Y-M-D) 2023-01-02
date: parsed time part: 12:00:00
date: input timezone: system default
Mon Jan  2 12:00:00 PM EST 2023
relunsec@relunsec:~/software/coreutils/target/debug$ 

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 with the date command and reproduce the listed format-parser and -d parsing cases against GNU date, including the --debug output. Group the mismatches by parser behavior and add focused regression coverage for each case; done means the Rust date command matches the GNU results shown in the issue.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
cli
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Active
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.