gronx
gronx copied to clipboard
Inconsistencies with crontab.guru
I evaluated this package to contain all that I need to implement a feature for a client, but once the feature had been implemented we discovered some inconsistencies between what we're getting and what https://crontab.guru is showing.
If I run the following function locally
func main() {
cron := "*/5 13,15 * * *"
now := time.Now().UTC()
nextDueAt, err := gronx.NextTickAfter(cron, now, true)
if err != nil {
panic(err)
}
fmt.Println("now:", now)
fmt.Println("nextDueAt:", nextDueAt.Format(time.RFC3339))
}
I get
now: 2023-10-11 10:26:16.648646 +0000 UTC
nextDueAt: 2023-10-11 13:30:00 +0000 UTC
and if I run it again a few minutes later I get
now: 2023-10-11 10:31:46.243188 +0000 UTC
nextDueAt: 2023-10-11 13:35:00 +0000 UTC
Both instances on crontab.guru show
“At every 5th minute past hour 13 and 15.”
next at 2023-10-11 13:00:00
It appears as though the minutes is retained during the calculations under specific circumstances, as this is not always the case 🤔
hi thanks, this must be issue related to #26 unfortunately im a little too busy for serious focus on it even when it is hacktoberfest season...
i think the fix lies in reverse looping but not that straight forward.