You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When making an instance call to set a locale, if the locale is supplied including the country code, but dayjs only has the generic language code, the global instance locale ends up getting overwritten.
For example, dayjs has the locale nb but if the full language tag with the country code is supplied to an instancelocale() update such as nb-no, the global instance locale will get changed.
[dayjs.locale(),//endayjs().locale('nb-no'),//nbdayjs.locale()//nb !!global locale is changed!!]
I suspect it's related to this fallback scenario in parseLocale() where the supplied locale is split and just the first part is recursively passed into parseLocale(), but it does not pass forward the additional parameters, so isLocal is not passed forward which ultimately causes the recursive locale parsing to improperly set the global instance locale.
When making an instance call to set a locale, if the locale is supplied including the country code, but dayjs only has the generic language code, the global instance locale ends up getting overwritten.
For example, dayjs has the locale
nb
but if the full language tag with the country code is supplied to an instancelocale()
update such asnb-no
, the global instance locale will get changed.I suspect it's related to this fallback scenario in
parseLocale()
where the supplied locale is split and just the first part is recursively passed intoparseLocale()
, but it does not pass forward the additional parameters, soisLocal
is not passed forward which ultimately causes the recursive locale parsing to improperly set the global instance locale.dayjs/src/index.js
Lines 26 to 29 in bdcc336
The text was updated successfully, but these errors were encountered: