[TASK] Replace deprecated moment.js function

This commit is contained in:
Xaver Maierhofer 2017-03-12 03:12:48 +01:00 committed by Geno
parent f265901036
commit d100db521b

View File

@ -35,7 +35,8 @@ define(['polyglot', 'moment', 'helper'], function (Polyglot, moment, helper) {
function setTranslation(json) { function setTranslation(json) {
_.extend(json); _.extend(json);
moment.locale(_.locale(), { if (moment.locale(_.locale()) !== _.locale()) {
moment.defineLocale(_.locale(), {
longDateFormat: { longDateFormat: {
LT: 'HH:mm', LT: 'HH:mm',
LTS: 'HH:mm:ss', LTS: 'HH:mm:ss',
@ -48,6 +49,7 @@ define(['polyglot', 'moment', 'helper'], function (Polyglot, moment, helper) {
relativeTime: json.momentjs.relativeTime relativeTime: json.momentjs.relativeTime
}); });
} }
}
window._ = new Polyglot({ locale: getLocale(), allowMissing: true }); window._ = new Polyglot({ locale: getLocale(), allowMissing: true });
helper.getJSON('locale/' + _.locale() + '.json?' + config.cacheBreaker).then(setTranslation); helper.getJSON('locale/' + _.locale() + '.json?' + config.cacheBreaker).then(setTranslation);