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

DateTimeFormatInfo.GetEra(string) does not work in a scenario #40194

Closed
alexeysmorkalov opened this issue Jul 31, 2020 · 2 comments · Fixed by #40300
Closed

DateTimeFormatInfo.GetEra(string) does not work in a scenario #40194

alexeysmorkalov opened this issue Jul 31, 2020 · 2 comments · Fixed by #40300

Comments

@alexeysmorkalov
Copy link

alexeysmorkalov commented Jul 31, 2020

DateTimeFormatInfo.GetEra(string) always returns -1 if you pass abbreviated english era name as input parameter

Steps to reproduce

            var ci = new CultureInfo("ja-JP") { DateTimeFormat = { Calendar = new JapaneseCalendar() }};
            var jpFormatInfo = ci.DateTimeFormat;

            // it returns -1 but expected 4
              var result = jpFormatInfo.GetEra("H");

Configuration

Fails on 5.0.100-preview.7.20366.6
Works correctly on any .NET Framework, .Net Core 3.0, .Net Core 3.1, .Net 5 lower than 5.0.100-preview.4.20258.7
x64

Regression

.Net Framework, Core 3.0, Core 3.1 and .Net5 until 5.0.100-preview.4.20258.7

Other information

The reason is System.Globalization.DateTimeFormatInfo.AbbreviatedEnglishEraNames contains not abbreviated but full era names

@Dotnet-GitSync-Bot Dotnet-GitSync-Bot added area-System.Globalization untriaged New issue has not been triaged by the area owner labels Jul 31, 2020
@ghost
Copy link

ghost commented Jul 31, 2020

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

@tarekgh tarekgh added bug and removed untriaged New issue has not been triaged by the area owner labels Aug 2, 2020
@tarekgh tarekgh added this to the 5.0.0 milestone Aug 2, 2020
@tarekgh
Copy link
Member

tarekgh commented Aug 2, 2020

Thanks @alexeysmorkalov for reporting the issue. we'll take a look to see what is going on.

@ghost ghost locked as resolved and limited conversation to collaborators Dec 8, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants