Block timer when it reach the end

This commit is contained in:
Pierre HUBERT 2020-05-04 20:16:04 +02:00
parent 0b87363d60
commit 2cc5539608

View File

@ -27,6 +27,11 @@ ComunicWeb.components.countdown = {
// find the amount of "seconds" between now and target // find the amount of "seconds" between now and target
var current_date = parseInt(new Date().getTime() / 1000); var current_date = parseInt(new Date().getTime() / 1000);
var seconds_left = time_end - current_date; var seconds_left = time_end - current_date;
if(seconds_left < 0) {
seconds_left = 0;
clearInterval(interval);
}
// do some time calculations // do some time calculations
days = parseInt(seconds_left / 86400); days = parseInt(seconds_left / 86400);