fix(139): fixed time zone (close #5263)

pull/5284/head v3.28.0
Andy Hsu 2023-09-22 16:54:16 +08:00
parent 0f03a747d8
commit a64dd4885e
2 changed files with 4 additions and 2 deletions

View File

@ -48,7 +48,7 @@ func calSign(body, ts, randStr string) string {
} }
func getTime(t string) time.Time { func getTime(t string) time.Time {
stamp, _ := time.ParseInLocation("20060102150405", t, time.Local) stamp, _ := time.ParseInLocation("20060102150405", t, utils.CNLoc)
return stamp return stamp
} }

View File

@ -5,8 +5,10 @@ import (
"time" "time"
) )
var CNLoc = time.FixedZone("UTC", 8*60*60)
func MustParseCNTime(str string) time.Time { func MustParseCNTime(str string) time.Time {
lastOpTime, _ := time.ParseInLocation("2006-01-02 15:04:05 -07", str+" +08", time.Local) lastOpTime, _ := time.ParseInLocation("2006-01-02 15:04:05 -07", str+" +08", CNLoc)
return lastOpTime return lastOpTime
} }