我正在编写一个倒数计时器,当到达close
时遇到问题,我试图显示timeremaing
直到第二天的open
。现在,我已经完成了code
,但它是在open
的同一天而不是第二天进行计算。
以下是整个code
的一部分。
var current = new Date();
var day = current.getDay();
var nextday = (nextday) = current.getDay(+1);
var currentTime = (currentTime) = (current.getHours() * 60) + current.getMinutes();
var remainTime = 0;
var closeTime = (openTime[day].close *60);
var openNextday = (openNextday) = nextday - (openTime[nextday].open *60);
var openTime = (openTime[day].open *60);
else if (closeTime - currentTime <= 0) {
remainTime = currentTime - openNextday;
document.getElementById("hours").innerHTML = "open in " + Math.floor(remainTime/60)+ " hours " + Math.floor(remainTime%60) + " Mins";
}