From 55efed92f9f47298ca3b1f6de3019c146c51accc Mon Sep 17 00:00:00 2001 From: Sebastian Sdorra Date: Wed, 30 Oct 2019 15:29:49 +0100 Subject: [PATCH] fix DateFromNow i18n without provided locales --- scm-ui/ui-components/src/DateFromNow.tsx | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/scm-ui/ui-components/src/DateFromNow.tsx b/scm-ui/ui-components/src/DateFromNow.tsx index 5ed175ee92..1803b43461 100644 --- a/scm-ui/ui-components/src/DateFromNow.tsx +++ b/scm-ui/ui-components/src/DateFromNow.tsx @@ -45,13 +45,18 @@ class DateFromNow extends React.Component { 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; };