diff --git a/src/job.ts b/src/job.ts index 8abe9711..b1d8be75 100644 --- a/src/job.ts +++ b/src/job.ts @@ -179,9 +179,13 @@ export class CronJob { if (!(time instanceof CronTime)) { throw new CronError('time must be an instance of CronTime.'); } + const wasRunning = this.running; this.stop(); + this.cronTime = time; + if (time.realDate) this.runOnce = true; + if (wasRunning) this.start(); }