JSFiddle - React, Tailwind, and code Playground
HTML
<div id="countdown"></div>
JavaScript
function ShowTime() {
var now = new Date();
if (now.getHours() > 11){
var hrs =11-now.getHours() +24;
}else{
var hrs = 11-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 sikre dig levering 1-3 dage fra ordremodtagelse";
$("#countdown").html(timeLeft);
}
var countdown;
function StopTime() {
clearInterval(countdown);
}
setInterval(ShowTime ,1000);