Skip to content

date: support out-of-range years in default output#13516

Open
abhishekpradhan wants to merge 2 commits into
uutils:mainfrom
abhishekpradhan:agent/date-large-year-default-output
Open

date: support out-of-range years in default output#13516
abhishekpradhan wants to merge 2 commits into
uutils:mainfrom
abhishekpradhan:agent/date-large-year-default-output

Conversation

@abhishekpradhan

@abhishekpradhan abhishekpradhan commented Jul 22, 2026

Copy link
Copy Markdown

Summary

  • preserve parse_datetime::ParsedDateTime::Extended values through the normal date -d display path
  • format default output through an equivalent in-range Gregorian year, then restore the actual extended year
  • keep existing in-range behavior and continue rejecting extended values for --set and non-default formats
  • add regressions for the reported year, the 9999/10000 boundary, and invalid large dates

The parser has supported these years since parse_datetime 0.15.0, but date still converted every result to Zoned and rejected the Extended variant.

Before and after

Before:

$ LANG=C TZ=UTC0 ./target/debug/date -d "18978-01-01"
date: invalid date '18978-01-01'

After:

$ LANG=C TZ=UTC0 ./target/debug/date -d "18978-01-01"
Thu Jan  1 00:00:00 UTC 18978

Fixes #9774.

Scope

This PR addresses the LANG=C default output reported in #9774. Default locale formats that use alternate or composite year directives, arbitrary +FORMAT parity, RFC/ISO output, and touch support are intentionally excluded.

Validation

  • cargo fmt --all -- --check
  • cargo check -p uu_date
  • cargo clippy -p uu_date --all-features --all-targets -- -D warnings
  • cargo test -p uu_date --lib --all-features -q
  • cargo test -q --test tests test_date:: -- --nocapture
  • repository pre-commit hooks for the changed files

@abhishekpradhan
abhishekpradhan marked this pull request as ready for review July 22, 2026 22:20
@github-actions

github-actions Bot commented Jul 23, 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)
Skipping an intermittent issue tests/cut/bounded-memory (passes in this run but fails in the 'main' branch)
Note: The gnu test tests/tail/tail-n0f is now being skipped but was previously passing.
Congrats! The gnu test tests/seq/seq-epipe is now passing!

@codspeed-hq

codspeed-hq Bot commented Jul 23, 2026

Copy link
Copy Markdown

Merging this PR will degrade performance by 23.82%

⚠️ Different runtime environments detected

Some benchmarks with significant performance changes were compared across different runtime environments,
which may affect the accuracy of the results.

Open the report in CodSpeed to investigate

❌ 1 regressed benchmark
✅ 338 untouched benchmarks
⏩ 46 skipped benchmarks1

Warning

Please fix the performance issues or acknowledge them on CodSpeed.

Performance Changes

Mode Benchmark BASE HEAD Efficiency
Memory cp_recursive_deep_tree[(120, 4)] 532.7 KB 699.2 KB -23.82%

Tip

Investigate this regression by commenting @codspeedbot fix this regression on this PR, or directly use the CodSpeed MCP with your agent.


Comparing abhishekpradhan:agent/date-large-year-default-output (5919ec1) with main (20bad75)

Open in CodSpeed

Footnotes

  1. 46 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.

@abhishekpradhan
abhishekpradhan force-pushed the agent/date-large-year-default-output branch from 5919ec1 to 2df802a Compare July 23, 2026 15:13
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.

Date rejects valid large years that GNU date accepts

1 participant