Skip to content

fix(date): support ISO-8601 with 12-hour time - #9275

Closed
naoNao89 wants to merge 2 commits into
uutils:mainfrom
naoNao89:fix/date-iso8601-12hour-time-9253
Closed

naoNao89 wants to merge 2 commits into
uutils:mainfrom
naoNao89:fix/date-iso8601-12hour-time-9253

Conversation

@naoNao89

Copy link
Copy Markdown
Contributor

Fixes parsing of ISO-8601 dates with 12-hour time (e.g., 2025-01-01 12:00am).

The parse_datetime crate's combined parser only accepts 24-hour format. Workaround converts dash-separated dates to slashes when 12-hour time is detected, forcing separate parsing where am/pm is supported.

Fixes #9253

@github-actions

Copy link
Copy Markdown

GNU testsuite comparison:

Skip an intermittent issue tests/tail/overlay-headers (fails in this run but passes in the 'main' branch)

1 similar comment
@github-actions

Copy link
Copy Markdown

GNU testsuite comparison:

Skip an intermittent issue tests/tail/overlay-headers (fails in this run but passes in the 'main' branch)

@naoNao89
naoNao89 force-pushed the fix/date-iso8601-12hour-time-9253 branch 2 times, most recently from 49d348f to ad73e7a Compare January 3, 2026 00:29
@naoNao89
naoNao89 force-pushed the fix/date-iso8601-12hour-time-9253 branch from ad73e7a to 4c825bf Compare February 18, 2026 14:26
The parse_datetime crate's combined parser only accepts 24-hour
time. When parsing "YYYY-MM-DD HH:MMam/pm", it fails because the
ISO time parser doesn't support meridiem indicators.

Normalize by converting dashes to slashes (YYYY-MM-DD → YYYY/MM/DD)
which forces separate parsing where 12-hour time is supported.

Implementation uses zero-allocation string slicing for efficiency.

Fixes uutils#9253
@naoNao89
naoNao89 force-pushed the fix/date-iso8601-12hour-time-9253 branch from 4c825bf to a3966a9 Compare February 18, 2026 14:32
@github-actions

Copy link
Copy Markdown

GNU testsuite comparison:

GNU test failed: tests/date/date-locale-hour. tests/date/date-locale-hour is passing on 'main'. Maybe you have to rebase?
GNU test failed: tests/misc/io-errors. tests/misc/io-errors is passing on 'main'. Maybe you have to rebase?
Note: The gnu test tests/rm/many-dir-entries-vs-OOM is now being skipped but was previously passing.
Note: The gnu test tests/tail/pipe-f is now being skipped but was previously passing.
Congrats! The gnu test tests/seq/seq-epipe is now passing!

Add comprehensive tests for issue uutils#9253 to verify ISO-8601 date formats
combined with 12-hour time (am/pm) parsing:
- Basic am/pm with ISO-8601 dates (YYYY-MM-DD)
- Time with seconds
- Case variations (am/AM, pm/PM)
- a.m./p.m. format
- Various hour values (1:30am, 11:59pm)
- Edge cases (noon, midnight, single digit hours)
- Non-ISO-8601 dates to ensure they still work

@HackingRepo HackingRepo 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.

Hi, @naoNao89

Add -f and -s tests also to see is also applied to them, because i see many prs got merged, of the military prefix j, added only on -d but not on -f or -s, so for not that happens, add a test for -f and -s to see is accepts AM or PM prefix and resolve the conflict.

@sylvestre

Copy link
Copy Markdown
Contributor

the CI has been failing on this one for a while and it hasn't been updated since, so i guess you moved on. closing, but feel free to reopen if you get back to it, thanks

@sylvestre sylvestre closed this Oct 11, 2026
@xtqqczze

Copy link
Copy Markdown
Collaborator

feel free to reopen if you get back to it, thanks

@anastygnome Presumably #9253 was fully resolved by #15111, so there should be no need to reopen this PR, right?

@anastygnome

Copy link
Copy Markdown
Contributor

It's part of what I'll push tonight

@naoNao89
naoNao89 deleted the fix/date-iso8601-12hour-time-9253 branch October 14, 2026 19:00
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.

iso-8601-style date with 12-hour time does not parse

5 participants