Improve pause info display and error handling

This commit is contained in:
Alexandr Stelnykovych
2025-11-26 13:01:24 +02:00
parent 4913147dd5
commit d635db77c2
4 changed files with 51 additions and 16 deletions

View File

@@ -222,8 +222,8 @@
<span class="text-secondary">
<span class="text-secondary">{{ pauseInfo }} </span>
</span>
<span class="text-secondary">
Auto-resume at <span class="text-secondary">{{ pauseInfoTillTime }} </span>
<span class="text-secondary" *ngIf="pauseInfoTillTime">
{{ pauseInfoTillTime }}
</span>
</div>
<hr/>

View File

@@ -50,8 +50,12 @@ export class NavigationComponent implements OnInit {
return '';
}
get pauseInfoTillTime(): string {
if (this.isPaused && this.pauseState?.TillTime)
return new Date(this.pauseState.TillTime).toLocaleTimeString(undefined, { hour12: false });
if (this.isPaused && this.pauseState?.TillTime) {
const date = new Date(this.pauseState.TillTime);
if (isNaN(date.getTime()) || date.getTime() < Date.now())
return '';
return `Auto-resume at ${date.toLocaleTimeString(undefined, { hour12: false })}`;
}
return '';
}