igDatePicker calendar falls back to default regional settings when 'en-US' is passed
damyanpetev opened this issue · comments
Description
The regional
option on the igDatePicker
applies regional settings to the underlying jQuery UI date picker as well. However, when 'en-US' the control sets the $.ig.util.regional
instead, which is the default regional and can be any valid one (in this case Japanese). This can cause the calendar to display in a different regional from the set option.
This is caused by changes for #1358
Steps to reproduce
- Run the attached sample
- Select en-US regional
- Open the date picker
Result
Calendar displayed in Japanese
Expected result
Calendar should display with en settings.
Attachments
@damyanpetev
This is occurring because of the explicit check for this.options.regional === 'en-US'
(link).
However, the check is necessary for the fix for #1358, as the default value for regional
is en-US
(inherited from widget component) (link).
We can approach the fix for this a couple of ways - we can either override the inherited value for regional
in the baseEditor
class (fixing the issue for all editors, but not for other controls) OR we can change the default value of regional
for the widget
class to defaults
(fixing the issue for all controls, but overriding existing behavior). The latter seems to be a more correct approach (as there is always a 'defaults' property set in the regional object) (link)