-
Notifications
You must be signed in to change notification settings - Fork 4.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Incorrect general long time pattern for some cultures on Android #103592
Comments
Tagging subscribers to this area: @dotnet/area-system-globalization |
I did some further investigations, this issue seems to be device-dependent. Just in case, this issue was reproduced with the |
CC @matouskozak |
This issue seems to relate to this runtime/src/libraries/System.Private.CoreLib/src/System/Globalization/CultureData.Icu.cs Line 354 in b93061a
The current implementation does not cover the full Unicode Date Format Patterns. In the case of Please consider supporting or partially supporting as many pattern symbols as possible just in case. |
Related PR: unicode-org/cldr#1297 |
Affected CLDR version: 40 and above (https://cldr.unicode.org/index/downloads/cldr-40#h.mc372kkefa0z) Affected Android version: 13 and above (https://developer.android.com/guide/topics/resources/internationalization#versioning-nougat) |
@PopSlime thanks for the update. We should support the CC @mkhamoyan |
Revise the ICU time format conversion logic to support all unquoted literal texts and the `B` and `b` pattern symbols. Fix dotnet#103592
Hi, @tarekgh. I've submitted a PR for this issue but I'm not sure how to test it. Would you mind checking it out? |
* Fix the ICU time format conversion logic Revise the ICU time format conversion logic to support all unquoted literal texts and the `B` and `b` pattern symbols. Fix dotnet#103592 * Clarify literal texts in the conversion logic * Add tests for verifying time patterns Add tests verifying that all the short and long time patterns either use a 24-hour clock or have an AM/PM designator. * Fix literal single quote and literal backslash conversion * Refactor the literal quote conversion logic * Revise the test logic to ignore literal texts and check pattern redundancy Modify the test logic so that it recognizes literal texts correctly, and fails if 12-hour and 24-hour clocks are used at the same time. * Revise the test logic to ensure all cultures are tested * Add comments to clarify the backslash conversion * Refactor the conversion logic Simplify some logic and improve readability. * Exclude bad ICU patterns from the tests * Exclude the VerifyTimePatterns tests from hybrid globalization on browser * Add missing usings * Improve readability of the for-loops
Description
On Android, some cultures have an incorrect general long time pattern, causing
DateTime.ToString(IFormatProvider)
to produce badly formatted strings.Reproduction Steps
Consider the following code:
Expected behavior
A correctly formatted string (like
2000/1/1 下午8:00:00
) is returned.Actual behavior
A badly formatted string
2000/1/1 8:00:00
is returned, in which a 12-hour clock is used without an AM/PM designator.Regression?
No response
Known Workarounds
No response
Configuration
Other information
No response
The text was updated successfully, but these errors were encountered: