From a24185e6dcad0880bedf6e941d14242ba015d32f Mon Sep 17 00:00:00 2001 From: "2569718930@qq.com" <2569718930@qq.com> Date: Sat, 16 May 2026 21:40:56 +0800 Subject: [PATCH] =?UTF-8?q?DEB=20=E9=A2=84=E6=B5=8B=E7=BA=BF=E5=A1=AB?= =?UTF-8?q?=E5=85=85=E9=A6=96=E5=B0=BE=E7=A9=BA=E5=80=BC=EF=BC=8C=E7=A1=AE?= =?UTF-8?q?=E4=BF=9D=E5=85=A8=E5=A4=A9=2000:00-23:00=20=E9=93=BA=E6=BB=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/lib/chart-utils.ts | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/frontend/lib/chart-utils.ts b/frontend/lib/chart-utils.ts index aa863c03..5da70d96 100644 --- a/frontend/lib/chart-utils.ts +++ b/frontend/lib/chart-utils.ts @@ -411,6 +411,17 @@ export function getTemperatureChartData( ? Number((temp + offset).toFixed(1)) : null, ); + const firstValid = debTemps.findIndex((t) => t != null); + const lastValid = (() => { + for (let i = debTemps.length - 1; i >= 0; i--) { + if (debTemps[i] != null) return i; + } + return -1; + })(); + if (firstValid >= 0 && lastValid >= 0) { + for (let i = 0; i < firstValid; i++) debTemps[i] = debTemps[firstValid]; + for (let i = lastValid + 1; i < debTemps.length; i++) debTemps[i] = debTemps[lastValid]; + } const debPast = debTemps.map((temp, index) => currentIndex >= 0 && index <= currentIndex ? temp : null, );