解决localtion

This commit is contained in:
timerzz 2024-09-13 23:11:33 +08:00
parent 05a5debf3c
commit 38c4267488

View File

@ -35,8 +35,7 @@ func (c *Cron) SetContext(ctx context.Context) *Cron {
func (c *Cron) SetTimeHHmm(HHmm string) *Cron { func (c *Cron) SetTimeHHmm(HHmm string) *Cron {
t, _ := time.Parse("15:04", HHmm) t, _ := time.Parse("15:04", HHmm)
now := time.Now() now := time.Now()
l, _ := time.LoadLocation("Asia/Shanghai") c.time = time.Date(now.Year(), now.Month(), now.Day(), t.Hour(), t.Minute(), 0, 0, now.Location())
c.time = time.Date(now.Year(), now.Month(), now.Day(), t.Hour(), t.Minute(), 0, 0, l)
return c return c
} }