Skip to content

date: support european dates and out-of-range years - #13818

Open
MuntasirSZN wants to merge 1 commit into
uutils:mainfrom
MuntasirSZN:date-pl
Open

date: support european dates and out-of-range years#13818
MuntasirSZN wants to merge 1 commit into
uutils:mainfrom
MuntasirSZN:date-pl

Conversation

@MuntasirSZN

@MuntasirSZN MuntasirSZN commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

date accepts DAY.MONTH[.YEAR] dates (yearless forms use the current
year) and years beyond 9999 with any format. uutils/coreutils rejected both,
failing parts of tests/date/date.pl.

Rewrite european dates to ISO before parsing; accept extended years for
all output formats. Adds unit and integration tests.

tests/date/date.pl gnu test now passes.

Signed-off-by: MuntasirSZN muntasir.joypurhat@gmail.com

@codspeed-hq

codspeed-hq Bot commented Aug 9, 2026

Copy link
Copy Markdown

Merging this PR will not alter performance

✅ 10 untouched benchmarks
⏩ 408 skipped benchmarks1


Comparing MuntasirSZN:date-pl (f277e47) with main (e0ff0eb)

Open in CodSpeed

Footnotes

  1. 408 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

@github-actions

github-actions Bot commented Aug 9, 2026

Copy link
Copy Markdown

GNU testsuite comparison:

Skip an intermittent issue tests/date/date-locale-hour (fails in this run but passes in the 'main' branch)
Skip an intermittent issue tests/tail/retry (fails in this run but passes in the 'main' branch)
Skip an intermittent issue tests/tail/tail-n0f (fails in this run but passes in the 'main' branch)
Skipping an intermittent issue tests/cut/bounded-memory (passes in this run but fails in the 'main' branch)
Skipping an intermittent issue tests/rm/isatty (passes in this run but fails in the 'main' branch)
Congrats! The gnu test tests/date/date is no longer failing!

@collinfunk

Copy link
Copy Markdown

These tests are copied from GNU coreutils and should be licensed as such.

@MuntasirSZN

Copy link
Copy Markdown
Contributor Author

These tests are copied from GNU coreutils and should be licensed as such.

Ok I gave attribution

@xtqqczze

xtqqczze commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

These tests are copied from GNU coreutils and should be licensed as such.

As per CONTRIBUTING.md, we cannot accept any changes based on the GNU source code. I recommend closing this PR and starting again from scratch.

@sylvestre

Copy link
Copy Markdown
Contributor

yeah, you need to rewrite the tests

@MuntasirSZN

Copy link
Copy Markdown
Contributor Author

yeah, you need to rewrite the tests

Ok doing it....

@github-actions

github-actions Bot commented Aug 9, 2026

Copy link
Copy Markdown

Binary size comparison:

Individual binary size comparison VS main (threshold: >=5% AND >=4 KB).

Total size of compared binaries: 148.94 MB (+324 KB, +0.21%)

Significant per-binary changes:
  install     1.24 MB ->    1.32 MB  (+80 KB, +6.29%)
  mkdir       1.09 MB ->    1.17 MB  (+80 KB, +7.14%)
  mkfifo      1.09 MB ->    1.16 MB  (+76 KB, +6.83%)
  mknod       1.09 MB ->    1.17 MB  (+76 KB, +6.79%)

@MuntasirSZN
MuntasirSZN force-pushed the date-pl branch 2 times, most recently from c918fea to e991362 Compare August 9, 2026 14:49
@MuntasirSZN

Copy link
Copy Markdown
Contributor Author

@sylvestre @collinfunk @xtqqczze Sorry for ping, can you guys check now?

@xtqqczze

xtqqczze commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

@MuntasirSZN Could you please confirm that no code in this PR has been derived from GNU coreutils or any other GPL-licensed source, including small snippets, helper structures, test fixtures, or comments?

If you used an AI assistant during development, please also verify its output carefully, as AI-generated code may reproduce material from GPL-licensed sources, potentially without making the provenance apparent.

@MuntasirSZN

Copy link
Copy Markdown
Contributor Author

@MuntasirSZN Could you please confirm that no code in this PR has been derived from GNU coreutils or any other GPL-licensed source, including small snippets, helper structures, test fixtures, or comments?

If you used an AI assistant during development, please also verify its output carefully, as AI-generated code may reproduce material from GPL-licensed sources, potentially without making the provenance apparent.

No, @xtqqczze. I verified myself.

@MuntasirSZN
MuntasirSZN force-pushed the date-pl branch 2 times, most recently from 7362f2a to 5c25094 Compare August 11, 2026 03:19
@MuntasirSZN

Copy link
Copy Markdown
Contributor Author

@sylvestre @cakebaker review pls? Sorry for ping.

@MuntasirSZN

Copy link
Copy Markdown
Contributor Author

@sylvestre @cakebaker is there anything else that is needed?

Copilot AI lite review requested due to automatic review settings August 20, 2026 02:34

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@MuntasirSZN

Copy link
Copy Markdown
Contributor Author

@xtqqczze @sylvestre @cakebaker This is another ping...

Copilot AI review requested due to automatic review settings August 22, 2026 11:48

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Copilot AI review requested due to automatic review settings August 23, 2026 05:17

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Copilot AI review requested due to automatic review settings September 5, 2026 10:49

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

There are correctness and UX issues in the new parsing/formatting paths (e.g., overly-permissive European token matching and incomplete extended-year substitution for format specifiers).

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Review details
  • Files reviewed: 2/2 changed files
  • Comments generated: 3
  • Review effort level: Lite

Comment thread src/uu/date/src/date.rs
Comment thread src/uu/date/src/date.rs Outdated
Comment thread src/uu/date/src/date.rs

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Extended-year formatting substitution currently misses GNU modifier forms (e.g. %+Y, %10Y) and composite specifiers (e.g. %x), so “any format string” extended-year support is not yet correct/covered.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Review details
  • Files reviewed: 2/2 changed files
  • Comments generated: 2
  • Review effort level: Lite

Comment thread src/uu/date/src/date.rs Outdated
Comment thread tests/by-util/test_date.rs

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The changes are well-covered by new tests and look consistent with the stated behavior, with only a minor comment/documentation nit identified.

Review details
  • Files reviewed: 3/3 changed files
  • Comments generated: 1
  • Review effort level: Lite

Comment thread src/uu/date/src/date.rs Outdated

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The European-date rewrite logic appears to mis-handle separate-year token positioning and 2-digit year semantics compared to GNU/POSIX expectations.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Review details

Suppressed comments (1)

src/uu/date/src/date.rs:1629

  • These assertions/documentation currently encode the behavior that 2-digit years are used verbatim (year 99), but GNU/POSIX date treats 2-digit years as 1969–2068. If rewrite_european_date is updated to expand 2-digit years, this test should be updated accordingly.
        // Inline year variants: one or two digits are passed through untouched,
        // longer years are kept whole; a following token (e.g. a timezone) is
        // not consumed as part of the date.
        assert_eq!(rewrite("11.6.99"), "99-06-11");
        assert_eq!(rewrite("11.6.12000"), "12000-06-11");
  • Files reviewed: 3/3 changed files
  • Comments generated: 2
  • Review effort level: Lite

Comment thread src/uu/date/src/date.rs Outdated
Comment thread src/uu/date/src/date.rs Outdated
Copilot AI review requested due to automatic review settings September 5, 2026 11:49

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Copilot AI review requested due to automatic review settings September 5, 2026 11:51

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

`date` accepts DAY.MONTH[.YEAR] dates (yearless forms use the current
year) and years beyond 9999 with any format. uutils rejected both,
failing parts of tests/date/date.pl.

Rewrite european dates to ISO before parsing; accept extended years for
all output formats. Adds unit and integration tests.

Signed-off-by: MuntasirSZN <muntasir.joypurhat@gmail.com
@MuntasirSZN
MuntasirSZN requested a lite review from Copilot September 5, 2026 12:04

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Copilot AI review requested due to automatic review settings September 5, 2026 12:05

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants