diff options
author | Florian Dold <florian.dold@gmail.com> | 2018-09-20 02:56:13 +0200 |
---|---|---|
committer | Florian Dold <florian.dold@gmail.com> | 2018-09-20 02:56:13 +0200 |
commit | bbff7403fbf46f9ad92240ac213df8d30ef31b64 (patch) | |
tree | c58400ec5124da1c7d56b01aea83309f80a56c3b /node_modules/moment/src/lib/locale | |
parent | 003fb34971cf63466184351b4db5f7c67df4f444 (diff) |
update packages
Diffstat (limited to 'node_modules/moment/src/lib/locale')
-rw-r--r-- | node_modules/moment/src/lib/locale/locales.js | 29 |
1 files changed, 20 insertions, 9 deletions
diff --git a/node_modules/moment/src/lib/locale/locales.js b/node_modules/moment/src/lib/locale/locales.js index 7d8fb26e0..af28bfe27 100644 --- a/node_modules/moment/src/lib/locale/locales.js +++ b/node_modules/moment/src/lib/locale/locales.js @@ -42,7 +42,7 @@ function chooseLocale(names) { } i++; } - return null; + return globalLocale; } function loadLocale(name) { @@ -77,6 +77,12 @@ export function getSetGlobalLocale (key, values) { // moment.duration._locale = moment._locale = data; globalLocale = data; } + else { + if ((typeof console !== 'undefined') && console.warn) { + //warn user if arguments are passed but the locale could not be set + console.warn('Locale ' + key + ' not found. Did you forget to load it?'); + } + } } return globalLocale._abbr; @@ -84,7 +90,7 @@ export function getSetGlobalLocale (key, values) { export function defineLocale (name, config) { if (config !== null) { - var parentConfig = baseConfig; + var locale, parentConfig = baseConfig; config.abbr = name; if (locales[name] != null) { deprecateSimple('defineLocaleOverride', @@ -97,14 +103,19 @@ export function defineLocale (name, config) { if (locales[config.parentLocale] != null) { parentConfig = locales[config.parentLocale]._config; } else { - if (!localeFamilies[config.parentLocale]) { - localeFamilies[config.parentLocale] = []; + locale = loadLocale(config.parentLocale); + if (locale != null) { + parentConfig = locale._config; + } else { + if (!localeFamilies[config.parentLocale]) { + localeFamilies[config.parentLocale] = []; + } + localeFamilies[config.parentLocale].push({ + name: name, + config: config + }); + return null; } - localeFamilies[config.parentLocale].push({ - name: name, - config: config - }); - return null; } } locales[name] = new Locale(mergeConfigs(parentConfig, config)); |