Repository navigation
date: drop the E modifier in the C locale - #15237
Open
yu2971512385-ui wants to merge 1 commit into
Open
yu2971512385-ui wants to merge 1 commit into
yu2971512385-ui wants to merge 1 commit into
Conversation
|
GNU testsuite comparison: |
sylvestre
reviewed
Oct 11, 2026
| } | ||
| match chars.peek() { | ||
| Some('O') => { | ||
| Some(&modifier @ ('O' | 'E')) => { |
Contributor
There was a problem hiding this comment.
what happens with a flag or width before the modifier, like %-Ey or %10EY? please add a test
sylvestre
reviewed
Oct 11, 2026
| .env("TZ", "UTC") | ||
| .arg("-d") | ||
| .arg("2024-06-15") | ||
| .arg("+%Ey-%EY-%EC") |
Contributor
There was a problem hiding this comment.
please also cover %Ec, %Ex and %EX, they are in the list but not tested
yu2971512385-ui
force-pushed
the
date-e-modifier
branch
from
October 12, 2026 10:19
c31213f to
b2dc0be
Compare
%Ey and the other five conversions POSIX pairs the E modifier with were passed through to jiff, which does not know the modifier and printed them literally: `date -d @1234567890 +%Ey` gave `%Ey` where GNU gives `09`. The C locale has no era representation, so the modifier falls back to the plain conversion, exactly as %O already does. strip_o_modifier handled only O, so it now handles both and is renamed to match. E is dropped only before c, C, x, X, y and Y, since GNU keeps the others literal, and a dangling %E or one behind %% stays literal as before. Both modifiers sit behind the GNU flags and field width, as in `%-Oy` or `%10EY`, so those are now skipped while looking for the modifier. That also fixes %O, which printed `%Oy` for `%-Oy` and `00000000%OY` for `%10OY`. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
yu2971512385-ui
force-pushed
the
date-e-modifier
branch
from
October 12, 2026 14:46
b2dc0be to
ef60c6c
Compare
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
date +%Eyprinted%Eyinstead of the year. The six conversions POSIX pairsthe
Emodifier with (%Ec %EC %Ex %EX %Ey %EY) all went through to jiff,which does not know the modifier and emits it literally.
In the C locale there is no era representation, so
Efalls back to the plainconversion — the same rule
%Oalready follows since #11656.strip_o_modifieronly looked for
O, so it now looks for both and is renamed accordingly.Eisdropped only before
c,C,x,X,yandY, because GNU leaves theother letters literal; a dangling
%E,%E9or anEbehind%%staysliteral as before, and
%Ohandling is unchanged.Checked against GNU coreutils 9.x with
LC_ALL=C TZ=UTC:%Ey%Ey09%EY%EY2009%EC%EC20%Ex%Ex02/13/09%EX%EX23:31:30%Ec%EcFri Feb 13 23:31:30 2009%Ej,%E,%E9,%%EyPart of #10958. It does not close it: that issue also asks for the ICU-backed
alternative representations, which #10994 is about — this only completes the
C-locale fallback that
%Oalready had.🤖 Generated with Claude Code