From 2cc5539608be1bd75c8976c701b3ec6b1502d204 Mon Sep 17 00:00:00 2001 From: Pierre HUBERT Date: Mon, 4 May 2020 20:16:04 +0200 Subject: [PATCH] Block timer when it reach the end --- assets/js/components/countdown.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/assets/js/components/countdown.js b/assets/js/components/countdown.js index 5e0bc6b2..fd1457b0 100644 --- a/assets/js/components/countdown.js +++ b/assets/js/components/countdown.js @@ -27,6 +27,11 @@ ComunicWeb.components.countdown = { // find the amount of "seconds" between now and target var current_date = parseInt(new Date().getTime() / 1000); var seconds_left = time_end - current_date; + + if(seconds_left < 0) { + seconds_left = 0; + clearInterval(interval); + } // do some time calculations days = parseInt(seconds_left / 86400);