Wijcie. Mam zegar na stronie odliczający czas do wydarzenie(kod po niżej) jak zrobić gdy mamy jeden dzień do wydarzenia zamiast "dn"i by pojawił się "dzień"
var countDownDateTime = new Date("SEP 17, 2017 20:00:00").getTime();
var myInterval = setInterval(function () { "use strict";
var currentDateTime = new Date().getTime();
var diff = countDownDateTime - currentDateTime;
var days = Math.floor(diff / (1000 * 60 * 60 * 24));
var hours = Math.floor((diff % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60));
var minutes = Math.floor((diff % (1000 * 60 * 60)) / (1000 * 60));
var seconds = Math.floor((diff % (1000 * 60)) / 1000);
document.getElementById("days").innerHTML = days;
document.getElementById("hours").innerHTML = hours;
document.getElementById("minutes").innerHTML = minutes;
document.getElementById("seconds").innerHTML = seconds;
if (diff < 0) {
clearInterval(myInterval);
document.getElementById("countDownBlock").style.display = "none";
}
}, 1000);
html
<div id="countDownBlock">
<div id="clockdiv">
<div>
<span id="days"></span>
<div class="text">Dni</div>
</div>
<div>
<span id="hours"></span>
<div class="text">Godzin</div>
</div>
<div>
<span id="minutes"></span>
<div class="text">Minut</div>
</div>
<div>
<span id="seconds"></span>
<div class="text">Sekund</div>
</div>
</div>
</div>
</div>