reugn / go-quartz

Minimalist and zero-dependency scheduling library for Go
https://pkg.go.dev/github.com/reugn/go-quartz/quartz
MIT License
1.8k stars 85 forks source link

CronTrigger use only UTC #27

Closed KiboMibo closed 2 years ago

KiboMibo commented 2 years ago
        cronTime := "0 30 21 * * ?"
    ct, err := quartz.NewCronTrigger(cronTime)
    if err != nil {
        return err
    }

    currentTime := time.Now().UnixNano()
    fmt.Println("CurrentTime:", time.Unix(currentTime/int64(time.Second), 0).String())

    nft, err := ct.NextFireTime(currentTime)
    if err != nil {
        return err
    }

         fmt.Println("NextFireTime:", time.Unix(nft/int64(time.Second), 0).String())

Result:

CurrentTime: 2022-03-23 09:09:25 +0300 MSK
NextFireTime: 2022-03-24 00:30:00 +0300 MSK

Looks like cron trigger set job time in UTC. Is there some option to set job in local time?