fix: 恢复使用服务器本地时间,不硬编码时区

- logger.ts: 使用 new Date() 服务器本地时间
- logs.ts: 统计使用服务器本地时间
- 时区显示由客户端处理
This commit is contained in:
2026-06-08 15:37:21 +08:00
parent 3ce5ff4b65
commit 7f6da1fa10
2 changed files with 6 additions and 15 deletions

View File

@@ -7,11 +7,9 @@ import { requireAdmin } from '../middleware/requireAdmin'
const router = Router()
const LOG_DIR = path.resolve(process.env.LOG_DIR || './logs')
/** 获取 UTC+8 今日日期字符串 */
/** 获取今日日期字符串 YYYY-MM-DD服务器本地时间 */
function getTodayStr(): string {
const now = new Date()
const utc = now.getTime() + now.getTimezoneOffset() * 60000
const d = new Date(utc + 8 * 3600000)
const d = new Date()
return `${d.getFullYear()}-${String(d.getMonth() + 1).padStart(2, '0')}-${String(d.getDate()).padStart(2, '0')}`
}