Fix "MMM.yy" date parsing in German culture.#114169
Closed
pra2892 wants to merge 0 commit intodotnet:mainfrom
Closed
Fix "MMM.yy" date parsing in German culture.#114169pra2892 wants to merge 0 commit intodotnet:mainfrom
pra2892 wants to merge 0 commit intodotnet:mainfrom
Conversation
Contributor
|
Tagging subscribers to this area: @dotnet/area-system-globalization |
Contributor
Author
@dotnet-policy-service agree |
Member
|
@pra2892 thanks for submitting the PR. I am seeing you added submodule called runtime to this PR. Please delete it. |
tarekgh
reviewed
Apr 2, 2025
Member
There was a problem hiding this comment.
I am not sure I understand this fix. the value of useGenitiveForm is always false so the condition will always be evaluated as false.
The fix should be, passing the format string to this method MatchAbbreviatedMonthName. and when checking
dtfi.FormatFlags & DateTimeFormatFlags.UseGenitiveMonth) != 0, can check if format string has d or dd specifiers.
pra2892
added a commit
to pra2892/runtime
that referenced
this pull request
Apr 2, 2025
pra2892
added a commit
to pra2892/runtime
that referenced
this pull request
Apr 2, 2025
This was referenced Apr 2, 2025
pra2892
added a commit
to pra2892/runtime
that referenced
this pull request
Apr 3, 2025
pra2892
added a commit
to pra2892/runtime
that referenced
this pull request
Apr 3, 2025
pra2892
added a commit
to pra2892/runtime
that referenced
this pull request
Apr 3, 2025
pra2892
added a commit
to pra2892/runtime
that referenced
this pull request
Apr 4, 2025
pra2892
added a commit
to pra2892/runtime
that referenced
this pull request
Apr 4, 2025
tarekgh
added a commit
that referenced
this pull request
Apr 12, 2025
* Fix "MMM.yy" date parsing in German culture. #114169 * Fix "MMM.yy" date parsing in German culture. #114169 * Fix "MMM.yy" date parsing in German culture. #114169 v3 * Fix "MMM.yy" date parsing in German culture. #114169 [Testing] * Fix "MMM.yy" date parsing in German culture. #114169 [Testing] v1 * Fix the test --------- Co-authored-by: Tarek Mahmoud Sayed <tarekms@microsoft.com>
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Fix DateTime.TryParseExact for "MMM.yy" format in German culture
This commit fixes an issue where DateTime.TryParseExact fails to parse dates formatted with "MMM.yy" in German culture (de-DE). The problem occurs because the parsing logic incorrectly tries to match against genitive month names when parsing abbreviated month names without day specifiers.
According to the documentation, genitive month names should only be used when the format pattern contains day specifiers ('d' or 'dd'). The "MMM.yy" format doesn't contain day specifiers, so regular month names should be used.
Modified the MatchAbbreviatedMonthName method to conditionally use genitive month names only when appropriate, fixing scenarios like:
Fixes #114159