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

31 FEB executes immediately #765

Closed
snus8bit opened this issue Aug 9, 2024 · 0 comments · Fixed by #766
Closed

31 FEB executes immediately #765

snus8bit opened this issue Aug 9, 2024 · 0 comments · Fixed by #766
Labels
bug Something isn't working

Comments

@snus8bit
Copy link

snus8bit commented Aug 9, 2024

Describe the bug

Minor bug. Schedule with non-existent day like "* * * 31 FEB *" executes immediately.

To Reproduce

package main

import (
	"fmt"
	"log"

	"github.com/go-co-op/gocron/v2"
)

func main() {
	c := make(chan struct{})
	s, err := gocron.NewScheduler()
	if err != nil {
		log.Fatal(err)
	}
	if _, err := s.NewJob(gocron.CronJob("* * * 31 FEB *", true), gocron.NewTask(func() {
		fmt.Println("started")
		c <- struct{}{}
	})); err != nil {
		log.Fatal(err)
	}
	s.Start()
	<-c
}

Expected behavior

Never to execute.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant