Skip to content

Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.

Refactor i18n calendar formatter

zbettenbukc86c7beb2482
diff --git a/react/features/base/util/dateUtil.js b/react/features/base/i18n/dateUtil.js
similarity index 91%
rename from react/features/base/util/dateUtil.js
rename to react/features/base/i18n/dateUtil.js
index 5b8a817032..376afa2a96 100644
--- a/react/features/base/util/dateUtil.js
+++ b/react/features/base/i18n/dateUtil.js
@@ -2,13 +2,11 @@
import moment from 'moment';
-import { i18next } from '../i18n';
+import i18next from './i18next';
// MomentJS uses static language bundle loading, so in order to support dynamic
// language selection in the app we need to load all bundles that we support in
// the app.
-// FIXME: If we decide to support MomentJS in other features as well we may need
-// to move this import and the lenient matcher to the i18n feature.
require('moment/locale/bg');
require('moment/locale/de');
require('moment/locale/eo');
@@ -32,7 +30,7 @@ require('moment/locale/zh-cn');
/**
* Returns a localized date formatter initialized with a specific {@code Date}
- * or time stamp ({@code number}).
+ * or timestamp ({@code number}).
*
* @private
* @param {Date | number} dateOrTimeStamp - The date or unix timestamp (ms)
diff --git a/react/features/base/i18n/index.js b/react/features/base/i18n/index.js
index e74374c7ed..59657a34e5 100644
--- a/react/features/base/i18n/index.js
+++ b/react/features/base/i18n/index.js
@@ -1,4 +1,4 @@
-
+export * from './dateUtil';
export * from './functions';
// TODO Eventually (e.g. when the non-React Web app is rewritten into React), it
diff --git a/react/features/base/util/index.js b/react/features/base/util/index.js
index 18214a274a..1a4ad8b913 100644
--- a/react/features/base/util/index.js
+++ b/react/features/base/util/index.js
@@ -1,4 +1,3 @@
-export * from './dateUtil';
export * from './helpers';
export * from './loadScript';
export * from './randomUtil';
diff --git a/react/features/calendar-sync/components/ConferenceNotification.native.js b/react/features/calendar-sync/components/ConferenceNotification.native.js
index c3515d135f..ef5ba6df6c 100644
--- a/react/features/calendar-sync/components/ConferenceNotification.native.js
+++ b/react/features/calendar-sync/components/ConferenceNotification.native.js
@@ -9,10 +9,9 @@ import { connect } from 'react-redux';
import { appNavigate } from '../../app';
import { getURLWithoutParams } from '../../base/connection';
-import { translate } from '../../base/i18n';
+import { getLocalizedDateFormatter, translate } from '../../base/i18n';
import { Icon } from '../../base/font-icons';
import { ASPECT_RATIO_NARROW } from '../../base/responsive-ui';
-import { getLocalizedDateFormatter } from '../../base/util';
import styles from './styles';
diff --git a/react/features/calendar-sync/components/MeetingList.native.js b/react/features/calendar-sync/components/MeetingList.native.js
index 79f7c580b6..4875e194e5 100644
--- a/react/features/calendar-sync/components/MeetingList.native.js
+++ b/react/features/calendar-sync/components/MeetingList.native.js
@@ -5,9 +5,8 @@ import { connect } from 'react-redux';
import { refreshCalendarEntryList } from '../actions';
import { appNavigate } from '../../app';
-import { translate } from '../../base/i18n';
+import { getLocalizedDateFormatter, translate } from '../../base/i18n';
import { NavigateSectionList } from '../../base/react';
-import { getLocalizedDateFormatter } from '../../base/util';
type Props = {
diff --git a/react/features/recent-list/components/RecentList.native.js b/react/features/recent-list/components/RecentList.native.js
index 19347c1f7d..57a62f5f33 100644
--- a/react/features/recent-list/components/RecentList.native.js
+++ b/react/features/recent-list/components/RecentList.native.js
@@ -3,13 +3,13 @@ import React, { Component } from 'react';
import { connect } from 'react-redux';
import { appNavigate } from '../../app';
-import { translate } from '../../base/i18n';
-import { NavigateSectionList } from '../../base/react';
import {
getLocalizedDateFormatter,
getLocalizedDurationFormatter,
- parseURIString
-} from '../../base/util';
+ translate
+} from '../../base/i18n';
+import { NavigateSectionList } from '../../base/react';
+import { parseURIString } from '../../base/util';
/**
* The type of the React {@code Component} props of {@link RecentList}