generated from react-component/footer
-
-
Notifications
You must be signed in to change notification settings - Fork 331
Closed
Description
The generateConfig
methods use dealLocal()
function to get date-fns
specific locale data for the provided language, but the implementation fails in some cases because rc-picker
locales names do not exactly match with date-fns
ones.
For example Italian:
rc-picker
useit_IT
as locale name;dealLocal()
converts it intoitIT
;generateConfig.getWeekFirstDay()
method tries to loaddate-fns
locale data with anitIT
key, but it does not exists and this leads toclone
constant to beundefined
.
The only solution is to replace the current dealLocal()
implementation with a static map of locales names and prevent errors with a default value:
const DEFAULT_LOCALE = 'enUS';
const LOCALES_MAP = {
'en_US': 'enUS',
'it_IT': 'it',
'es_ES': 'es',
// and so on...
}
const dealLocal = (str: string): string => LOCALES_MAP[str] || DEFAULT_LOCALE;
giotramu, stepanzin, Roguehp98, b1617, todorone and 3 more
Metadata
Metadata
Assignees
Labels
No labels