Skip to content

date: strip the O strftime modifier in the C locale - #13702

Open
igorgbr wants to merge 1 commit into
uutils:mainfrom
igorgbr:fix/date-o-modifier
Open

date: strip the O strftime modifier in the C locale#13702
igorgbr wants to merge 1 commit into
uutils:mainfrom
igorgbr:fix/date-o-modifier

Conversation

@igorgbr

@igorgbr igorgbr commented Aug 1, 2026

Copy link
Copy Markdown

Fixes #11656

In the C locale the O strftime modifier requests alternative numeric
symbols that do not exist, so GNU date treats it as a no-op: %Om
renders exactly like %m. jiff does not know the modifier and emitted it
literally.

Strip the modifier from the format string before jiff sees it, mirroring
the existing substitute_epoch_seconds pass. %% is preserved so that an
O following a literal percent stays plain text.

Before:

    $ LC_ALL=C TZ=UTC date -d 2024-06-15 +%Om-%Oy-%Ol
    %Om-%Oy-%Ol

After (matches GNU):

    $ LC_ALL=C TZ=UTC date -d 2024-06-15 +%Om-%Oy-%Ol
    06-24-12

The test for this behaviour already existed in tests/by-util/test_date.rs
marked #[ignore]; this PR removes the ignore.

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: strftime O modifier leaks as literal in C locale

1 participant