feat(cp排行榜): 倒计时暂时设置成2月19早上5点

This commit is contained in:
hzj 2026-01-19 23:07:16 +08:00
parent 85c693924f
commit 96ad884191

View File

@ -335,7 +335,7 @@ const startCountdown = () => {
monthlyCountdownTimer = setInterval(getMonthlyCountdown, 1000)
}
// 15
// 2195
const getNextMonthFirstInBeijing = () => {
const now = new Date()
@ -346,24 +346,21 @@ const getNextMonthFirstInBeijing = () => {
const date = beijingTime.getUTCDate()
const hour = beijingTime.getUTCHours()
//
// - 219219219
let targetYear = year
let targetMonth = month
if (date === 1 && hour < 5) {
// 1515
} else {
// 1
targetMonth = month + 1
if (targetMonth > 11) {
targetMonth = 0
targetYear++
}
// 219
if (month > 1 || (month === 1 && date > 19) || (month === 1 && date === 19 && hour >= 5)) {
// 2195219
targetYear = year + 1
}
// UTC
// 21
const targetMonth = 1 // 2101
// UTC - 2191
// 使Date.UTC""
const targetDateAsBeijing = Date.UTC(targetYear, targetMonth, 1, 5, 0, 0) - 8 * 60 * 60 * 1000
const targetDateAsBeijing = Date.UTC(targetYear, targetMonth, 19, 5, 0, 0) - 8 * 60 * 60 * 1000
return targetDateAsBeijing
}