parentConfig = tmpLocale._config;
}
config = mergeConfigs(parentConfig, config);
+ if (tmpLocale == null) {
+ // updateLocale is called for creating a new locale
+ // Set abbr so it will have a name (getters return
+ // undefined otherwise).
+ config.abbr = name;
+ }
locale = new Locale(config);
locale.parentLocale = locales[name];
locales[name] = locale;
moment.updateLocale('de', null);
});
+test('update non-existing locale', function (assert) {
+ moment.locale('en');
+ moment.updateLocale('dude', { months: ['Movember'] });
+ assert.equal(moment.locale(), 'dude');
+ assert.equal(moment().locale('dude').locale(), 'dude');
+ moment.defineLocale('dude', null);
+});
+
test('reset locale', function (assert) {
moment.locale('de');
var resultBeforeUpdate = moment('2017-02-01').format('YYYY MMM MMMM');