From 708679c619edcf1fa2802103c1aa63b95dba139c Mon Sep 17 00:00:00 2001 From: HuskyTeufel Date: Fri, 14 Jan 2022 08:09:29 +0100 Subject: [PATCH] Countdown geht nicht ins negative --- ui/src/app/countdown/countdown.component.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ui/src/app/countdown/countdown.component.ts b/ui/src/app/countdown/countdown.component.ts index 098898e..de3749c 100644 --- a/ui/src/app/countdown/countdown.component.ts +++ b/ui/src/app/countdown/countdown.component.ts @@ -12,11 +12,12 @@ export class CountdownComponent implements OnInit { ngOnInit(): void { } - countDownDate = new Date("Aug 20, 2022 13:00:00").getTime(); + countDownDate = new Date("Aug 20, 2022 14:00:00").getTime(); Counter = new CountDown(); x = setInterval(() => { var now = new Date().getTime(); var distance = this.countDownDate - now; + if (distance < 0) distance = 0; var days = Math.floor(distance /(1000*60*60*24)); var hours = Math.floor((distance % (1000*60*60*24)) / (1000*60*60)); var minutes = Math.floor((distance % (1000*60*60)) / (1000*60));