Fix scheduled live stream
This commit is contained in:
parent
350aa8240a
commit
78e7eaa689
3 changed files with 6 additions and 5 deletions
|
@ -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<Props, State> {
|
||||
|
@ -58,7 +59,7 @@ class DateTime extends React.Component<Props, State> {
|
|||
}
|
||||
|
||||
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<Props, State> {
|
|||
>
|
||||
{date
|
||||
? timeAgo
|
||||
? getTimeAgoStr(date)
|
||||
? getTimeAgoStr(date, showFutureDate)
|
||||
: moment(date).format(type === 'date' ? 'MMMM Do, YYYY' : clockFormat)
|
||||
: '...'}
|
||||
</span>
|
||||
|
|
|
@ -29,7 +29,7 @@ const LivestreamDateTime = (props: Props) => {
|
|||
}
|
||||
return (
|
||||
<span>
|
||||
{__('Live')} <DateTime timeAgo uri={uri} />
|
||||
{__('Live')} <DateTime timeAgo uri={uri} showFutureDate />
|
||||
</span>
|
||||
);
|
||||
};
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue