From f7df659c8572aaf62a03d0519ae400df4159c614 Mon Sep 17 00:00:00 2001 From: AskaEth Date: Tue, 23 Jun 2026 19:43:43 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E8=BF=98=E5=8E=9F=E7=B3=BB=E7=BB=9F?= =?UTF-8?q?=E6=97=B6=E5=8C=BA=E6=96=B9=E6=A1=88=20=E2=80=94=20=E6=97=B6?= =?UTF-8?q?=E9=97=B4=E6=88=B3=E5=B7=B2=E8=87=AA=E5=B8=A6+08:00?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ethend/src/index.js | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/ethend/src/index.js b/ethend/src/index.js index 69569c7..0fbc9e7 100644 --- a/ethend/src/index.js +++ b/ethend/src/index.js @@ -1907,19 +1907,12 @@ server.listen(ETHEND_PORT, () => { } }); -// 时间格式化:始终显示 UTC+8 (Asia/Shanghai) +// 时间格式化:使用系统本地时区 function formatLocalTime(ts) { var d = new Date(ts); var pad = function(n) { return n < 10 ? '0' + n : '' + n; }; - // Force UTC+8 regardless of system timezone - var utcH = d.getUTCHours(); - var utcM = d.getUTCMinutes(); - var utcS = d.getUTCSeconds(); - var localH = (utcH + 8) % 24; - var dayOffset = Math.floor((utcH + 8) / 24); - var localD = new Date(Date.UTC(d.getUTCFullYear(), d.getUTCMonth(), d.getUTCDate() + dayOffset)); - return localD.getUTCFullYear() + '-' + pad(localD.getUTCMonth()+1) + '-' + pad(localD.getUTCDate()) + ' ' + - pad(localH) + ':' + pad(utcM) + ':' + pad(utcS); + return d.getFullYear() + '-' + pad(d.getMonth()+1) + '-' + pad(d.getDate()) + ' ' + + pad(d.getHours()) + ':' + pad(d.getMinutes()) + ':' + pad(d.getSeconds()); } // 优雅退出