aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSaúl Ibarra Corretgé <s@saghul.net>2018-07-27 10:21:40 +0200
committerSaúl Ibarra Corretgé <s@saghul.net>2018-07-27 20:57:03 +0200
commitc21ed1bdaa4ccf93f7f55e0485068e10cf4201fb (patch)
tree4cd5d3343dbd97f6d0b96e29c550482d68519632
parent56e0588efc281a653d41c653d188276d7ecf16ff (diff)
Separate conference start time and duration into 2 lines
-rw-r--r--app/features/recent-list/components/RecentList.js26
1 files changed, 20 insertions, 6 deletions
diff --git a/app/features/recent-list/components/RecentList.js b/app/features/recent-list/components/RecentList.js
index 7fd4c04..8135757 100644
--- a/app/features/recent-list/components/RecentList.js
+++ b/app/features/recent-list/components/RecentList.js
@@ -76,7 +76,10 @@ class RecentList extends Component<Props, *> {
{ this._renderServerURL(conference.serverURL) }
</TruncatedText>
<TruncatedText>
- { this._renderTimeAndDuration(conference) }
+ { this._renderStartTime(conference) }
+ </TruncatedText>
+ <TruncatedText>
+ { this._renderDuration(conference) }
</TruncatedText>
</ConferenceCard>
);
@@ -95,18 +98,29 @@ class RecentList extends Component<Props, *> {
}
/**
- * Returns Date/Time and Duration of the conference in string format.
+ * Returns the duration of the conference in string format.
*
* @param {RecentListItem} conference - Conference Details.
* @returns {string} - Date/Time and Duration.
*/
- _renderTimeAndDuration(conference: RecentListItem) {
+ _renderDuration(conference: RecentListItem) {
const { startTime, endTime } = conference;
const start = moment(startTime);
- const end = moment(endTime);
- const duration = moment.duration(end.diff(start)).humanize();
+ const end = moment(endTime || Date.now());
+
+ return moment.duration(end.diff(start)).humanize();
+ }
+
+ /**
+ * Returns the Date/Time of the conference in string format.
+ *
+ * @param {RecentListItem} conference - Conference Details.
+ * @returns {string} - Date/Time and Duration.
+ */
+ _renderStartTime(conference: RecentListItem) {
+ const { startTime } = conference;
- return `${start.calendar()}, ${duration}`;
+ return moment(startTime).calendar();
}
}