feat(倒计时): 将周一刷新改成沙特的周一早上6点

This commit is contained in:
hzj 2025-09-17 16:26:32 +08:00
parent 4dc912e4ab
commit 28aae509e1

View File

@ -797,17 +797,18 @@ const Minutes = ref(0)
const Second = ref(0)
let timer = null
const getNextMonday = () => {
//
const getNextMondayInSaudi = () => {
const now = new Date()
const day = now.getDay() //0()-6()
const utcDay = now.getUTCDay() //UTC0()-6()
//
const daysToAdd = day === 1 ? 7 : (1 + 7 - day) % 7
const nextMonday = new Date(now) //
const daysToAdd = utcDay === 1 ? 7 : (1 + 7 - utcDay) % 7
const nextMondayUTC = new Date(now) //UTC
nextMonday.setDate(now.getDate() + daysToAdd) //
nextMonday.setHours(0, 0, 0, 0) // 00:00:00.000
return nextMonday.getTime() //00:00:00.000
nextMondayUTC.setUTCDate(now.getUTCDate() + daysToAdd) //
nextMondayUTC.setUTCHours(3, 0, 0, 0) // 63
return nextMondayUTC.getTime() //00:00:00.000
}
// 2
@ -815,7 +816,7 @@ const formatTime = (value) => {
return value < 10 ? `0${value}` : value
}
const targetTime = ref(getNextMonday()) // ()
const targetTime = ref(getNextMondayInSaudi()) // ()
//
const getCountdown = () => {