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

[FEATURE] - run a job on the last weekday of the month #804

Open
rsvix opened this issue Dec 12, 2024 · 2 comments
Open

[FEATURE] - run a job on the last weekday of the month #804

rsvix opened this issue Dec 12, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@rsvix
Copy link

rsvix commented Dec 12, 2024

Describe the bug

Gocron cronjob cant parse "LW", errors with invalid syntax

To Reproduce

`
package main
import (
"log"
"github.com/go-co-op/gocron/v2"
)
func main() {
s, err := gocron.NewScheduler()
if err != nil {
log.Fatal(err)
}

_, err = s.NewJob(
	gocron.CronJob("0 0 5 LW * ?", true),
	gocron.NewTask(func() {
		log.Println("Test job 1")
	}),
)
if err != nil {
	log.Printf("Test job 1 err: %v", err)
}

_, err = s.NewJob(
	gocron.CronJob("0 5 LW * ?", false),
	gocron.NewTask(func() {
		log.Println("Test job 2")
	}),
)
if err != nil {
	log.Printf("Test job 2 err: %v", err)
}

s.Start()
for {
}

}
`

Version

v2.13.0

Expected behavior

The expression should be parsed since its a valid cron expression

@rsvix rsvix added the bug Something isn't working label Dec 12, 2024
@JohnRoesler
Copy link
Contributor

Hi @rsvix,

A few thoughts:

Is it fair to say, this is actually a feature request to support:

  • The ability to run a job on the last weekday of the month?

@rsvix
Copy link
Author

rsvix commented Dec 12, 2024

Hello @JohnRoesler,

Thats fair, i will update it to a feature request
Sad that https://github.com/robfig/cron seems to be abandoned and the PRs are still not merged.

@rsvix rsvix changed the title [BUG] - Cronjob cant parse LW [FEATURE] - Cronjob cant parse LW Dec 12, 2024
@JohnRoesler JohnRoesler changed the title [FEATURE] - Cronjob cant parse LW [FEATURE] - run a job on the last weekday of the month Dec 12, 2024
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

No branches or pull requests

2 participants