调整建站计时时间计算问题

This commit is contained in:
j m 2024-04-28 11:25:12 +08:00
parent d2878f68ff
commit 4fef0a82e5
2 changed files with 4 additions and 5 deletions

View File

@ -389,10 +389,9 @@ const commonContext = {
if (DreamConfig.website_time === '') { if (DreamConfig.website_time === '') {
return return
} }
const now = new Date() const grt = new Date(DreamConfig.website_time).getTime()
const grt = new Date(DreamConfig.website_time)
setInterval(function () { setInterval(function () {
now.setTime(now.getTime() + 1000) let now = Date.now()
let difference = parseInt((now - grt) / 1000) let difference = parseInt((now - grt) / 1000)
let seconds = difference % 60 let seconds = difference % 60
if (String(seconds).length === 1) { if (String(seconds).length === 1) {
@ -412,7 +411,7 @@ const commonContext = {
} }
let days = parseInt(difference / 24) let days = parseInt(difference / 24)
websiteDate.innerHTML = `建站<span class="stand">${days}</span>天<span class="stand">${hours}</span>时<span class="stand">${minutes}</span>分<span class="stand">${seconds}</span>秒` websiteDate.innerHTML = `建站<span class="stand">${days}</span>天<span class="stand">${hours}</span>时<span class="stand">${minutes}</span>分<span class="stand">${seconds}</span>秒`
}, 1000) }, 500)
}, },
/* 显示web版权 */ /* 显示web版权 */
webCopyright() { webCopyright() {

File diff suppressed because one or more lines are too long