[Form] Fix ICU 72+ whitespace handling in DateTimeToLocalizedStringTransformer#63113
Merged
nicolas-grekas merged 1 commit intoJan 20, 2026
Merged
Conversation
6cd3971 to
3500eee
Compare
3500eee to
44276e7
Compare
roukmoute
added a commit
to roukmoute/symfony
that referenced
this pull request
Jan 18, 2026
…ansformer ICU 72+ uses Unicode whitespace characters (such as U+202F narrow no-break space) in formatted date strings instead of regular ASCII spaces. This caused parsing failures when users typed dates with regular spaces. This fix: - Normalizes transform() output to use regular ASCII spaces for consistent display - Makes reverseTransform() accept both regular spaces and ICU 72+ whitespace by trying both formats when parsing fails Fix symfony#63113 (review)
44276e7 to
b9f24b7
Compare
roukmoute
added a commit
to roukmoute/symfony
that referenced
this pull request
Jan 18, 2026
b9f24b7 to
3fec179
Compare
roukmoute
added a commit
to roukmoute/symfony
that referenced
this pull request
Jan 18, 2026
3fec179 to
7fb73f9
Compare
DateTimeToLocalizedStringTransformer
xabbuh
reviewed
Jan 19, 2026
roukmoute
added a commit
to roukmoute/symfony
that referenced
this pull request
Jan 19, 2026
7fb73f9 to
0cd8d72
Compare
roukmoute
added a commit
to roukmoute/symfony
that referenced
this pull request
Jan 19, 2026
roukmoute
added a commit
to roukmoute/symfony
that referenced
this pull request
Jan 19, 2026
1fc744f to
aee1caf
Compare
roukmoute
added a commit
to roukmoute/symfony
that referenced
this pull request
Jan 19, 2026
aee1caf to
1cfc076
Compare
1cfc076 to
2c1fae0
Compare
nicolas-grekas
approved these changes
Jan 20, 2026
Member
nicolas-grekas
left a comment
There was a problem hiding this comment.
rebased for 6.4 since that's the oldest maintained version affected
Member
|
Thank you @roukmoute. |
This was referenced Jan 24, 2026
Merged
Merged
Merged
Merged
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.
Summary
ICU 72+ uses Unicode whitespace characters (such as U+202F narrow no-break space) in formatted date strings instead of regular ASCII spaces. This caused parsing failures when users typed dates with regular spaces.
This fix:
transform()output to use regular ASCII spaces for consistent displayreverseTransform()accept both regular spaces and ICU 72+ whitespace by trying both formats when parsing failsHow it works
transform(): After formatting withIntlDateFormatter, the output is normalized to replace special Unicode whitespace (U+00A0, U+202F, U+2009) with regular ASCII spaces (U+0020).reverseTransform(): A newparse()method tries to parse the input as-is first. If parsing fails and the input contains regular spaces, it retries by replacing regular spaces with U+202F (the narrow no-break space used by ICU 72+).This ensures:
Test
The previously skipped test
testReverseTransformFromDifferentLocalenow works with all ICU versions.