From bbff7403fbf46f9ad92240ac213df8d30ef31b64 Mon Sep 17 00:00:00 2001 From: Florian Dold Date: Thu, 20 Sep 2018 02:56:13 +0200 Subject: update packages --- node_modules/moment/src/lib/locale/locales.js | 29 ++++++++++++++++++--------- 1 file changed, 20 insertions(+), 9 deletions(-) (limited to 'node_modules/moment/src/lib/locale') 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)); -- cgit v1.2.3