Skip to content
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

Fix fr-CA culture time formatting and parsing #56443

Merged
merged 1 commit into from
Jul 28, 2021

Conversation

tarekgh
Copy link
Member

@tarekgh tarekgh commented Jul 28, 2021

Fixes #54021

fr-CA culture is using time format pattern like HH 'h' mm 'min' ss 's' which is causing 2 problems:

  • First, we usually derive the time separator from the time pattern. That causing us to use h as time separator. So, when formatting any DateTime object using this culture we produce wrong formatted time e.g., 10 h 5 h 50 h. note that h is used to separate the hour, minute, and second parts in the formatted string.
  • Second, the formatted time cannot get parsed back when using DateTime.Parse. This is because we cannot recognize the parts like `min' and 's' in the formatted time.

The fix here is we are special casing this culture to explicitly setting the time separator to : which is other French cultures are using. Also, we added some support for this culture in the date/time parser to recognize such formats.

@ghost
Copy link

ghost commented Jul 28, 2021

Tagging subscribers to this area: @tarekgh, @safern
See info in area-owners.md if you want to be subscribed.

Issue Details

Fixes #54021

fr-CA culture is using time format pattern like HH 'h' mm 'min' ss 's' which is causing 2 problems:

  • First, we usually derive the time separator from the time pattern. That causing us to use h as time separator. So, when formatting any DateTime object using this culture we produce wrong formatted time e.g. 10 h 5 h 50 h. note that h is used to separate the hour, minute, and second parts in the formatted string.
  • Second, the formatted time cannot parse back when using DateTime.Parse. This is because we cannot recognize the parts like `min' and 's' in the formatted time.

The fix here is we are special casing this culture to explicitly setting the time separator to : which is other French cultures are using. Also, we added some support for this culture in the date/time parser to recognize such formats.

Author: tarekgh
Assignees: -
Labels:

area-System.Globalization

Milestone: -

@tarekgh tarekgh self-assigned this Jul 28, 2021
@tarekgh tarekgh requested a review from safern July 28, 2021 01:03
@tarekgh tarekgh added this to the 6.0.0 milestone Jul 28, 2021
@tarekgh
Copy link
Member Author

tarekgh commented Jul 28, 2021

@safern could you please have a look? Thanks!

@tarekgh tarekgh merged commit cd1b4cf into dotnet:main Jul 28, 2021
@tarekgh tarekgh deleted the FixFrCADateFormattingAndParsing branch July 28, 2021 20:02
@ghost ghost locked as resolved and limited conversation to collaborators Aug 27, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

fr-CA culture is different in Linux than Windows
2 participants