diff --git a/example_test.go b/example_test.go index 310fb43..3d449d1 100644 --- a/example_test.go +++ b/example_test.go @@ -267,6 +267,9 @@ func ExampleJob_nextRun() { ), ) + // NextRun is only available after the scheduler has been started. + s.Start() + nextRun, _ := j.NextRun() fmt.Println(nextRun) } @@ -284,6 +287,9 @@ func ExampleJob_nextRuns() { ), ) + // NextRuns is only available after the scheduler has been started. + s.Start() + nextRuns, _ := j.NextRuns(5) fmt.Println(nextRuns) } diff --git a/job.go b/job.go index 67930e2..cd0f4e1 100644 --- a/job.go +++ b/job.go @@ -1190,8 +1190,12 @@ type Job interface { // Name returns the name defined on the job. Name() string // NextRun returns the time of the job's next scheduled run. + // This value is only available once the scheduler has been started + // with Scheduler.Start(). Before that, it returns the zero time value. NextRun() (time.Time, error) // NextRuns returns the requested number of calculated next run values. + // These values are only available once the scheduler has been started + // with Scheduler.Start(). Before that, it returns nil. NextRuns(int) ([]time.Time, error) // RunNow runs the job once, now. This does not alter // the existing run schedule, and will respect all job