fix(module:datepicker): incorrect date format strings fix #1097
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.
馃 This is a ...
馃敆 Related issue link
#1044
#1093
馃挕 Background and solution
Most of locale
.json
file had incorrect string template (YYYY
instead ofyyyy
andD
instead ofd
).LocaleProvider
was usingCultureInfo.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 toCultureInfo.CurrentUICulture
for detection.In
DatePicker
if theCultureInfo
attribute was used without settingLocale
attribute, still onlyCultureInfo.DefaultThreadCurrentUICulture
was being picked up. The fix is to detect if parameterCultureInfo
was set outside and force load theLocale
with passedCultureInfo
. This exposed a situation when culture file does not exist (in my case I was trying to useel-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