Skip to content

Commit

Permalink
more than 1 day before last day of month gets stuck in a loop (#555)
Browse files Browse the repository at this point in the history
  • Loading branch information
JohnRoesler authored Aug 30, 2023
1 parent b86d02b commit d7dd276
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion scheduler.go
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,7 @@ func calculateNextRunForLastDayOfMonth(s *Scheduler, job *Job, lastRun time.Time
// last run occurred before the end of the month.
addMonth := job.getInterval()
atTime := job.getAtTime(lastRun)
if testDate := lastRun.AddDate(0, 0, 1); testDate.Month() != lastRun.Month() &&
if testDate := lastRun.AddDate(0, 0, -dayBeforeLastOfMonth); testDate.Month() != lastRun.Month() &&
!s.roundToMidnightAndAddDSTAware(lastRun, atTime).After(lastRun) {
// Our last run was on the last day of this month.
addMonth++
Expand Down

0 comments on commit d7dd276

Please sign in to comment.