fix DateFromNow i18n without provided locales

This commit is contained in:
Sebastian Sdorra
2019-10-30 15:29:49 +01:00
parent 8b632fdb37
commit 55efed92f9

View File

@@ -45,13 +45,18 @@ class DateFromNow extends React.Component<Props> {
getLocale = (): Locale => {
const { i18n } = this.props;
for (const lng of i18n.languages) {
for (const lng of i18n.languages || []) {
const locale = supportedLocales[lng];
if (locale) {
return locale;
}
}
const locale = supportedLocales[i18n.language];
if (locale) {
return locale;
}
return enUS;
};