JSFiddle - React, Tailwind, and code Playground
HTML
<div id="countdown"></div>
JavaScript
function ShowTime() {
var now = new Date();
if (now.getHours() > 10){
var hrs =10-now.getHours()+24;
if(now.getDay() == 5){
var hrs = hrs + 48;
}
if(now.getDay() == 6){
var hrs = hrs + 24;
}
}else{
var hrs = 10-now.getHours();
}
var mins = 60-now.getMinutes();
var secs = 60-now.getSeconds();
timeLeft = "Du har nu "+hrs+' timer '+mins+' minutter '+secs+' sekunder' +" til at gennemføre en ordre - og dermed sikre dig leveringen indenfor 24 timer";
$("#countdown").html(timeLeft);
}
var countdown;
function StopTime() {
clearInterval(countdown);
}
setInterval(ShowTime ,1000);