diff --git a/i18n/module/i18n_module_en.properties b/i18n/module/i18n_module_en.properties index 35599e78..a1f87dc4 100644 --- a/i18n/module/i18n_module_en.properties +++ b/i18n/module/i18n_module_en.properties @@ -152,4 +152,5 @@ no=No password_changed_successfully=Password changed successfully login_again=You need to login again to continue using the application. login=Login -not_applicable=N/A \ No newline at end of file +never=Never +invalid_date=Invalid date \ No newline at end of file diff --git a/src/aboutPage/AboutPage.component.js b/src/aboutPage/AboutPage.component.js index 3b40e054..2c666aa3 100644 --- a/src/aboutPage/AboutPage.component.js +++ b/src/aboutPage/AboutPage.component.js @@ -4,21 +4,25 @@ import PropTypes from 'prop-types'; import AboutSection from './AboutSection.component'; const parseDateFromUTCString = (utcString, d2) => { - if (!utcString) { - return d2.i18n.getTranslation('not_applicable') + try { + if (!utcString) { + return d2.i18n.getTranslation('never') + } + + const locale = d2.currentUser.userSettings.settings.keyUiLocale; + const date = new Date(utcString); + const options = { + day: 'numeric', + month: 'long', + year: 'numeric', + hour: '2-digit', + minute: '2-digit', + hour12: false, + }; + return new Intl.DateTimeFormat(locale, options).format(date); + } catch (error) { + return d2.i18n.getTranslation('invalid_date') } - - const locale = d2.currentUser.userSettings.settings.keyUiLocale; - const date = new Date(utcString); - const options = { - day: 'numeric', - month: 'long', - year: 'numeric', - hour: '2-digit', - minute: '2-digit', - hour12: false, - }; - return new Intl.DateTimeFormat(locale, options).format(date); }; const attributes = {