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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(module:datepicker): incorrect date format strings fix #1097

Merged
merged 2 commits into from
Feb 5, 2021

Conversation

anddrzejb
Copy link
Member

馃 This is a ...

  • New feature
  • Bug fix
  • Site / documentation update
  • Demo update
  • Component style update
  • Bundle size optimization
  • Performance optimization
  • Refactoring
  • Code style optimization
  • Test Case
  • Branch merge
  • Other (about what?)

馃敆 Related issue link

#1044
#1093

馃挕 Background and solution

Most of locale .json file had incorrect string template (YYYY instead of yyyy and D instead of d).
LocaleProvider was using CultureInfo.DefaultThreadCurrentUICulture for detection of current culture. But this is not working well with server version - there is a high possibility it will pick up server's UI instead of browser's UI. A switch was done to CultureInfo.CurrentUICulture for detection.
In DatePicker if the CultureInfo attribute was used without setting Locale attribute, still only CultureInfo.DefaultThreadCurrentUICulture was being picked up. The fix is to detect if parameter CultureInfo was set outside and force load the Locale with passed CultureInfo. This exposed a situation when culture file does not exist (in my case I was trying to use el-CY and it was crashing). Fallback logic was added and default locale is picked up if no locale .json file is found.

鈽戯笍 Self Check before Merge

鈿狅笍 Please check all items below before review. 鈿狅笍

  • Doc is updated/provided or not needed
  • Demo is updated/provided or not needed
  • Changelog is provided or not needed

@ElderJames
Copy link
Member

Awesome! Thank you.

@ElderJames ElderJames merged commit 1621763 into ant-design-blazor:master Feb 5, 2021
@anddrzejb anddrzejb deleted the datePickerLocaleFix branch February 9, 2021 18:23
ElderJames pushed a commit that referenced this pull request Apr 23, 2022
* fix(module:datepicker): incorrect date format strings fix

culture set takes effect
fallback to default local when locale json does not exist

* fix(module:datepicker): do not replace Locale if is set in attribute
ElderJames pushed a commit that referenced this pull request Apr 30, 2022
* fix(module:datepicker): incorrect date format strings fix

culture set takes effect
fallback to default local when locale json does not exist

* fix(module:datepicker): do not replace Locale if is set in attribute
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

DatePicker Internationalization es-ES Year Issue DatePicker and CultureInfo
2 participants