From 96ad8841917f002d45ebb18899272bb35ac8dec5 Mon Sep 17 00:00:00 2001 From: hzj <1304805162@qq.com> Date: Mon, 19 Jan 2026 23:07:16 +0800 Subject: [PATCH] =?UTF-8?q?feat(cp=E6=8E=92=E8=A1=8C=E6=A6=9C):=20?= =?UTF-8?q?=E5=80=92=E8=AE=A1=E6=97=B6=E6=9A=82=E6=97=B6=E8=AE=BE=E7=BD=AE?= =?UTF-8?q?=E6=88=902=E6=9C=8819=E6=97=A9=E4=B8=8A5=E7=82=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/Ranking/Couple/Ranking.vue | 25 +++++++++++-------------- 1 file changed, 11 insertions(+), 14 deletions(-) diff --git a/src/views/Ranking/Couple/Ranking.vue b/src/views/Ranking/Couple/Ranking.vue index 17670e4..e63717d 100644 --- a/src/views/Ranking/Couple/Ranking.vue +++ b/src/views/Ranking/Couple/Ranking.vue @@ -335,7 +335,7 @@ const startCountdown = () => { monthlyCountdownTimer = setInterval(getMonthlyCountdown, 1000) } -// 获取下个月1号早上5点的北京时间 +// 获取2月19号早上5点的北京时间 const getNextMonthFirstInBeijing = () => { const now = new Date() @@ -346,24 +346,21 @@ const getNextMonthFirstInBeijing = () => { const date = beijingTime.getUTCDate() const hour = beijingTime.getUTCHours() - // 确定目标月份 + // 确定目标年份 - 如果当前时间在本年度2月19日之前,则目标是今年2月19日;否则是明年2月19日 let targetYear = year - let targetMonth = month - if (date === 1 && hour < 5) { - // 如果今天是1号且还没过5点,目标就是本月1号5点 - } else { - // 否则目标是下个月1号 - targetMonth = month + 1 - if (targetMonth > 11) { - targetMonth = 0 - targetYear++ - } + // 检查是否已经超过今年的2月19日 + if (month > 1 || (month === 1 && date > 19) || (month === 1 && date === 19 && hour >= 5)) { + // 如果当前时间已经超过今年的2月19日5点,则目标是明年的2月19日 + targetYear = year + 1 } - // 创建代表北京时间的UTC时间戳 + // 目标月份固定为2月(月份索引为1) + const targetMonth = 1 // 2月的索引是1(0是1月) + + // 创建代表北京时间的UTC时间戳 - 2月19号而不是1号 // 使用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 }