Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inconsistencies with crontab.guru #33

Closed
taylow opened this issue Oct 11, 2023 · 1 comment · Fixed by #35
Closed

Inconsistencies with crontab.guru #33

taylow opened this issue Oct 11, 2023 · 1 comment · Fixed by #35

Comments

@taylow
Copy link

taylow commented Oct 11, 2023

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 🤔

@adhocore
Copy link
Owner

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants