fix: 修复前后端时区问题和日期范围选择器性能

- 前端时区修复:统一使用本地时区格式化日期
- 日期范围选择器优化:使用 untrack 避免循环更新
- 后端时区修复:使用 time.ParseInLocation 指定本地时区
- 其他优化:修复分页逻辑
This commit is contained in:
2026-01-10 01:55:45 +08:00
parent 48332efce4
commit 6d33132a4a
2 changed files with 10 additions and 7 deletions

View File

@@ -489,13 +489,14 @@ func saveCleanedBillsFromJSON(filePath, billType, sourceFile, uploadBatch string
}
// parseTime 解析时间字符串
// 使用本地时区解析,避免 UTC 时区问题
func parseTime(s string) time.Time {
s = strings.TrimSpace(s)
if s == "" {
return time.Time{}
}
// 尝试多种时间格式
// 尝试多种时间格式(使用本地时区)
formats := []string{
"2006-01-02 15:04:05",
"2006/01/02 15:04:05",
@@ -506,7 +507,7 @@ func parseTime(s string) time.Time {
}
for _, format := range formats {
if t, err := time.Parse(format, s); err == nil {
if t, err := time.ParseInLocation(format, s, time.Local); err == nil {
return t
}
}