From 78e7eaa689f85fc60ba764170bfb4231d2bf846b Mon Sep 17 00:00:00 2001 From: Rafael Date: Mon, 3 Jan 2022 17:05:19 -0300 Subject: [PATCH] Fix scheduled live stream --- ui/component/dateTime/view.jsx | 7 ++++--- ui/component/livestreamDateTime/view.jsx | 2 +- ui/util/time.js | 2 +- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/ui/component/dateTime/view.jsx b/ui/component/dateTime/view.jsx index 62140862d..c72c98921 100644 --- a/ui/component/dateTime/view.jsx +++ b/ui/component/dateTime/view.jsx @@ -13,8 +13,9 @@ type Props = { clock24h?: boolean, date?: any, minUpdateDeltaMs?: number, - type?: string, + showFutureDate?: boolean, timeAgo?: boolean, + type?: string, }; class DateTime extends React.Component { @@ -58,7 +59,7 @@ class DateTime extends React.Component { } render() { - const { clock24h, date, type, timeAgo } = this.props; + const { clock24h, date, showFutureDate, timeAgo, type } = this.props; const clockFormat = clock24h ? 'HH:mm' : 'hh:mm A'; @@ -69,7 +70,7 @@ class DateTime extends React.Component { > {date ? timeAgo - ? getTimeAgoStr(date) + ? getTimeAgoStr(date, showFutureDate) : moment(date).format(type === 'date' ? 'MMMM Do, YYYY' : clockFormat) : '...'} diff --git a/ui/component/livestreamDateTime/view.jsx b/ui/component/livestreamDateTime/view.jsx index c06d4071f..cffbe9dfa 100644 --- a/ui/component/livestreamDateTime/view.jsx +++ b/ui/component/livestreamDateTime/view.jsx @@ -29,7 +29,7 @@ const LivestreamDateTime = (props: Props) => { } return ( - {__('Live')} + {__('Live')} ); }; diff --git a/ui/util/time.js b/ui/util/time.js index 73c0b14eb..c6dead123 100644 --- a/ui/util/time.js +++ b/ui/util/time.js @@ -47,7 +47,7 @@ export function getTimeAgoStr(date: any, showFutureDate?: boolean) { duration = Math.floor(moment().diff(date, s)); suffix = s; - return duration > 0; + return duration > 0 || (showFutureDate && duration * -1 > 0); }); // negative duration === it's a future date from now