From 88543efe5c2d089265ad7c1e57dea480dbfa2cc3 Mon Sep 17 00:00:00 2001 From: root Date: Fri, 27 Feb 2026 09:02:15 +0000 Subject: [PATCH] =?UTF-8?q?fix:=20show=20nextFundingTime=20in=20Beijing=20?= =?UTF-8?q?time,=20add=20=E6=98=8E=E5=A4=A9=20prefix=20if=20next=20day?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/components/RateCard.tsx | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/frontend/components/RateCard.tsx b/frontend/components/RateCard.tsx index 667ed96..a363b94 100644 --- a/frontend/components/RateCard.tsx +++ b/frontend/components/RateCard.tsx @@ -19,9 +19,16 @@ export default function RateCard({ asset, data }: Props) { ? "bg-emerald-50 text-emerald-700 border border-emerald-200" : "bg-red-50 text-red-600 border border-red-200"; - const nextTime = data?.nextFundingTime - ? new Date(data.nextFundingTime).toLocaleTimeString("zh-CN", { hour: "2-digit", minute: "2-digit" }) - : "--"; + const nextTime = (() => { + if (!data?.nextFundingTime) return "--"; + // 转北京时间(UTC+8) + const ts = data.nextFundingTime; + const bjt = new Date(ts + 8 * 3600 * 1000); + const now = new Date(Date.now() + 8 * 3600 * 1000); + const isToday = bjt.getUTCDate() === now.getUTCDate() && bjt.getUTCMonth() === now.getUTCMonth(); + const hhmm = `${String(bjt.getUTCHours()).padStart(2,"0")}:${String(bjt.getUTCMinutes()).padStart(2,"0")}`; + return isToday ? hhmm : `明天 ${hhmm}`; + })(); return (