Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
  • Loading branch information
JohnRoesler authored Feb 25, 2025
1 parent 11de5c7 commit f271bbf
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions job.go
Original file line number Diff line number Diff line change
Expand Up @@ -146,14 +146,14 @@ type defaultCron struct {
withSeconds bool
}

func (r *defaultCron) IsValid(crontab string) error {
func (r *defaultCron) IsValid(crontab string, location *time.Location, now time.Time) error {
var withLocation string
if strings.HasPrefix(crontab, "TZ=") || strings.HasPrefix(crontab, "CRON_TZ=") {
withLocation = crontab
} else {
// since the user didn't provide a timezone default to the location
// passed in by the scheduler. Default: time.Local
withLocation = fmt.Sprintf("CRON_TZ=%s %s", time.Local, crontab)
withLocation = fmt.Sprintf("CRON_TZ=%s %s", location.String(), crontab)
}

var (
Expand Down

0 comments on commit f271bbf

Please sign in to comment.