Skip to content

Commit

Permalink
fix: hide live duration when broadcastStartTime is missing from the e…
Browse files Browse the repository at this point in the history
…ntry (Simulive)
  • Loading branch information
amirch1 committed Nov 4, 2020
1 parent 96a834d commit ede8a6a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<div class="kStatus">
<i class="kStatusIcon" [ngClass]="_entry?.streamStatus | appStreamState:true"></i>
<span class="kStreamStatus">{{_entry?.streamStatus | appStreamState}}</span>
<span *ngIf="_isLive">{{_streamDuration | appStreamDuration}}</span>
<span *ngIf="_isLive">{{_streamDuration | appStreamDuration:false}}</span>
</div>
<div *ngIf="_isLive" class="kRedundancy">
<i class="kIcon" [ngClass]="_entry?.redundancy ? 'kIconcheck_small' : 'kIconclose_small'"></i>
Expand Down
12 changes: 6 additions & 6 deletions src/app/shared/pipes/stream-duration.pipe.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ import * as moment from 'moment';
export class StreamDurationPipe implements PipeTransform {
constructor(private _translate: TranslateService) {
}
transform(duration: moment.Duration): string {
let timeString = '00:00:00';

transform(duration: moment.Duration, showWhenEmpty = true): string {
let timeString = showWhenEmpty ? '00:00:00' : '';

if (duration) {
if (duration.months() > 0) {
timeString = this._translate.instant('app.entryLive.stream_duration_in_months', { months: duration.months(), days: duration.days() });
Expand All @@ -21,10 +21,10 @@ export class StreamDurationPipe implements PipeTransform {
timeString = this._padTo2Digits(duration.hours()) + ':' + this._padTo2Digits(duration.minutes()) + ':' + this._padTo2Digits(duration.seconds());
}
}

return timeString;
}

private _padTo2Digits(number: number): string {
return ((0 <= number && number < 10) ? '0' : '') + number;
}
Expand Down

0 comments on commit ede8a6a

Please sign in to comment.