Skip to content
Snippets Groups Projects
Unverified Commit 71aaf9b4 authored by Nick Fitzpatrick's avatar Nick Fitzpatrick Committed by GitHub
Browse files

try/catch around moment.locale (#22291)

parent b04bad7c
No related branches found
No related tags found
No related merge requests found
......@@ -80,11 +80,15 @@ export function setLocalization(translationsObject) {
function updateMomentLocale(locale) {
const momentLocale = mapToMomentLocale(locale);
if (momentLocale !== "en") {
require("moment/locale/" + momentLocale);
try {
if (momentLocale !== "en") {
require("moment/locale/" + momentLocale);
}
moment.locale(momentLocale);
} catch (e) {
console.warn(`Could not set moment locale to ${momentLocale}`);
moment.locale("en");
}
moment.locale(momentLocale);
}
function mapToMomentLocale(locale = "") {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment