fix: 恢复使用服务器本地时间,不硬编码时区
- logger.ts: 使用 new Date() 服务器本地时间 - logs.ts: 统计使用服务器本地时间 - 时区显示由客户端处理
This commit is contained in:
@@ -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')}`
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user