chore(游戏王活动): 添加注释
This commit is contained in:
parent
ad28626119
commit
a908d445bf
@ -635,8 +635,7 @@ const showRanking = computed(() => {
|
|||||||
// 获取对应的时间戳
|
// 获取对应的时间戳
|
||||||
const getNextMondayInBeijing = () => {
|
const getNextMondayInBeijing = () => {
|
||||||
const now = new Date()
|
const now = new Date()
|
||||||
// 创建一个基于当前时间的新日期对象
|
const targetDate = new Date(now.getTime()) // 创建一个基于当前时间的新日期对象
|
||||||
const targetDate = new Date(now.getTime())
|
|
||||||
|
|
||||||
// 转换为北京时间来判断星期几
|
// 转换为北京时间来判断星期几
|
||||||
const utcTime = now.getTime() + now.getTimezoneOffset() * 60000
|
const utcTime = now.getTime() + now.getTimezoneOffset() * 60000
|
||||||
@ -652,7 +651,7 @@ const getNextMondayInBeijing = () => {
|
|||||||
if (normalizedDay === 0) {
|
if (normalizedDay === 0) {
|
||||||
// 今天是周一
|
// 今天是周一
|
||||||
if (beijingHour >= 5) {
|
if (beijingHour >= 5) {
|
||||||
daysToAdd = 7 // 下周一
|
daysToAdd = 7 // 超过5点,计算到下周一的所需时间
|
||||||
} else {
|
} else {
|
||||||
daysToAdd = 0 // 今天
|
daysToAdd = 0 // 今天
|
||||||
}
|
}
|
||||||
@ -661,8 +660,8 @@ const getNextMondayInBeijing = () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 正确地添加天数
|
// 正确地添加天数
|
||||||
targetDate.setDate(targetDate.getDate() + daysToAdd)
|
targetDate.setDate(targetDate.getDate() + daysToAdd) // 添加天数到下周一的当前时间
|
||||||
targetDate.setHours(5, 0, 0, 0) // 设置为早上5点
|
targetDate.setHours(5, 0, 0, 0) // 将时间重新设置为早上5点,作为目标时间戳
|
||||||
|
|
||||||
return targetDate.getTime()
|
return targetDate.getTime()
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user