Skip to content

date: fix -u flag to match GNU behavior for input parsing#10715

Merged
cakebaker merged 1 commit intouutils:mainfrom
ChrisDryden:date-utc-flag
Feb 5, 2026
Merged

date: fix -u flag to match GNU behavior for input parsing#10715
cakebaker merged 1 commit intouutils:mainfrom
ChrisDryden:date-utc-flag

Conversation

@ChrisDryden
Copy link
Collaborator

There are a few test cases in the date GNU test and an issue that was made about the behavior that in many use cases the -u flag is not used and the behavior of the date implementation was not matching the GNU implementation when the date is passed as stdin and when when combinations of the -u and -d were used.

The main summary of the change is that parse_date takes in Zoned now which uses the same logic for every location where a date is parsed and it will use the -u flag if it is applied. There were also issues with the logic for parsing the timezone where: "Try to parse the date with UTC first to get timestamp" was used and this causes the uutils implementation to provide the incorrect date.

Fixes: #9018

@codspeed-hq
Copy link

codspeed-hq bot commented Feb 4, 2026

Merging this PR will improve performance by 5.21%

⚡ 1 improved benchmark
✅ 283 untouched benchmarks
⏩ 38 skipped benchmarks1

Performance Changes

Mode Benchmark BASE HEAD Efficiency
Simulation file_tz_abbreviations 18.3 ms 17.4 ms +5.21%

Comparing ChrisDryden:date-utc-flag (798f97c) with main (b5a5c47)

Open in CodSpeed

Footnotes

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

@cakebaker cakebaker merged commit 4ae4902 into uutils:main Feb 5, 2026
158 of 159 checks passed
@cakebaker
Copy link
Contributor

Thanks!

@github-actions
Copy link

github-actions bot commented Feb 5, 2026

GNU testsuite comparison:

Skip an intermittent issue tests/misc/usage_vs_getopt (fails in this run but passes in the 'main' branch)
Congrats! The gnu test tests/tail/symlink is no longer failing!

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: -u flag ignored in some cases

2 participants