diff --git a/frontend/app/kline/page.tsx b/frontend/app/kline/page.tsx index 1cfcc3f..804529a 100644 --- a/frontend/app/kline/page.tsx +++ b/frontend/app/kline/page.tsx @@ -39,10 +39,28 @@ function chartOptions(height: number) { horzLines: { color: "#f1f5f9" }, }, crosshair: { mode: 1 }, + localization: { + timeFormatter: (ts: number) => { + // UTC+8 北京时间 + const d = new Date((ts + 8 * 3600) * 1000); + const Y = d.getUTCFullYear(); + const M = String(d.getUTCMonth() + 1).padStart(2, "0"); + const D = String(d.getUTCDate()).padStart(2, "0"); + const h = String(d.getUTCHours()).padStart(2, "0"); + const m = String(d.getUTCMinutes()).padStart(2, "0"); + return `${Y}-${M}-${D} ${h}:${m}`; + }, + }, timeScale: { borderColor: "#e2e8f0", timeVisible: true, secondsVisible: false, + tickMarkFormatter: (ts: number) => { + const d = new Date((ts + 8 * 3600) * 1000); + const h = String(d.getUTCHours()).padStart(2, "0"); + const m = String(d.getUTCMinutes()).padStart(2, "0"); + return `${h}:${m}`; + }, }, rightPriceScale: { borderColor: "#e2e8f0" }, height,