diff --git a/ppanel.go b/ppanel.go index a2e8110..7fb787d 100644 --- a/ppanel.go +++ b/ppanel.go @@ -1,6 +1,20 @@ package main -import "github.com/perfect-panel/server/cmd" +import ( + "time" + + "github.com/perfect-panel/server/cmd" +) + +func init() { + // Ensure time.Local matches DSN loc=Asia/Shanghai. + // In scratch Docker images, Go defaults to UTC even with TZ set, + // causing time range queries to shift by 8 hours. + loc, err := time.LoadLocation("Asia/Shanghai") + if err == nil { + time.Local = loc + } +} func main() { cmd.Execute()