Skip to content

Conversation

@naoNao89
Copy link
Contributor

@naoNao89 naoNao89 commented Oct 8, 2025

Fixes #8754

Problem

The date command fails with "invalid date" when parsing large second values with nanoseconds:

# Before - fails
$ date -d "12345.123456789 seconds ago" +"%s.%N"
1759894374.858517789

@naoNao89 naoNao89 force-pushed the fix-parse-datetime-update branch from e1d88e3 to 4340913 Compare October 8, 2025 06:46
@github-actions
Copy link

github-actions bot commented Oct 8, 2025

GNU testsuite comparison:

GNU test failed: tests/touch/relative. tests/touch/relative is passing on 'main'. Maybe you have to rebase?
Skip an intermittent issue tests/tail/overlay-headers (fails in this run but passes in the 'main' branch)
Skipping an intermittent issue tests/misc/tee (passes in this run but fails in the 'main' branch)
Skipping an intermittent issue tests/timeout/timeout (passes in this run but fails in the 'main' branch)
Congrats! The gnu test tests/date/date-tz is no longer failing!

@naoNao89 naoNao89 force-pushed the fix-parse-datetime-update branch 2 times, most recently from 3371f17 to 3e1d11c Compare October 15, 2025 02:32
@github-actions
Copy link

GNU testsuite comparison:

Skipping an intermittent issue tests/timeout/timeout (passes in this run but fails in the 'main' branch)
Congrats! The gnu test tests/date/date-tz is no longer failing!

@naoNao89 naoNao89 force-pushed the fix-parse-datetime-update branch from 3e1d11c to da6ede1 Compare October 15, 2025 03:26
@github-actions
Copy link

GNU testsuite comparison:

Skipping an intermittent issue tests/misc/tee (passes in this run but fails in the 'main' branch)
Congrats! The gnu test tests/date/date-tz is no longer failing!

@naoNao89 naoNao89 force-pushed the fix-parse-datetime-update branch from da6ede1 to d55a0ee Compare October 15, 2025 06:55
@github-actions
Copy link

GNU testsuite comparison:

Skipping an intermittent issue tests/tail/overlay-headers (passes in this run but fails in the 'main' branch)
Skipping an intermittent issue tests/timeout/timeout (passes in this run but fails in the 'main' branch)
Congrats! The gnu test tests/date/date-tz is no longer failing!

@naoNao89 naoNao89 marked this pull request as draft October 16, 2025 02:15
@sylvestre
Copy link
Contributor

@naoNao89 ping ? :)

renovate bot and others added 4 commits October 26, 2025 20:03
Fixes uutils#8754

parse_datetime 0.13.0 fixes the bug where parsing large second values
like "12345.123456789 seconds ago" would fail with "invalid date".

However, parse_datetime 0.13.0 introduced a breaking API change:
- Old (0.11.0): Returns chrono::DateTime
- New (0.13.0): Returns jiff::Zoned

This commit adapts both date and touch utilities to work with the new API:

date.rs changes:
- Simplified parse_date() to directly return jiff::Zoned
- Removed unnecessary chrono -> jiff conversion code
- parse_datetime now returns the exact type date utility uses
- Added detailed comments explaining the API change and issue uutils#8754

touch.rs changes:
- Added jiff::Zoned -> chrono::DateTime conversion in parse_date()
- Changed from parse_datetime_at_date to parse_datetime
- Marked ref_time parameter as unused (preserved for future use)
- Added detailed comments about API change and future migration path

Note: 3 integration tests fail due to timezone handling changes in
parse_datetime 0.13. These are separate issues that will be addressed
in follow-up commits.
…ates

The previous implementation incorrectly used parse_datetime() instead of
parse_datetime_at_date(), causing relative date strings like 'yesterday' or
'2 days ago' to be calculated from the current system time instead of the
caller-specified reference time.

This fix:
- Uses parse_datetime_at_date() with proper chrono->jiff->chrono conversions
- Restores deterministic behavior for relative date parsing
- Adds jiff 0.2.15 as direct dependency (not workspace) to avoid feature conflicts
- Ensures tests/touch/relative passes in CI

Note on jiff dependency:
parse_datetime 0.13 depends on jiff ^0.2.15 with specific features. Adding jiff
via workspace dependency causes feature unification conflicts across platforms.
Using a direct dependency with version 0.2.15 resolves this while maintaining
compatibility with parse_datetime's requirements.
@sylvestre sylvestre force-pushed the fix-parse-datetime-update branch from d55a0ee to 980fc7f Compare October 26, 2025 19:56
@codspeed-hq
Copy link

codspeed-hq bot commented Oct 26, 2025

CodSpeed Performance Report

Merging #8843 will degrade performances by 3.01%

Comparing naoNao89:fix-parse-datetime-update (149c7a6) with main (8f6e720)

Summary

❌ 1 regression
✅ 104 untouched
⏩ 74 skipped1

⚠️ Please fix the performance issues or acknowledge them on CodSpeed.

Benchmarks breakdown

Benchmark BASE HEAD Change
du_human_balanced_tree[(5, 4, 10)] 10.1 ms 10.4 ms -3.01%

Footnotes

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

@sylvestre sylvestre force-pushed the fix-parse-datetime-update branch from a93985d to 149c7a6 Compare October 26, 2025 20:24
@github-actions
Copy link

GNU testsuite comparison:

Skipping an intermittent issue tests/tail/overlay-headers (passes in this run but fails in the 'main' branch)
Congrats! The gnu test tests/date/date-tz is no longer failing!

@sylvestre sylvestre marked this pull request as ready for review October 26, 2025 21:08
@sylvestre sylvestre merged commit c2488a4 into uutils:main Oct 26, 2025
121 of 122 checks passed
@naoNao89 naoNao89 deleted the fix-parse-datetime-update branch October 27, 2025 03:43
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.

Invalid date of date -d "12345.123456789 seconds ago" +"%s.%N"

2 participants