I would like to schedule tasks like this:
- schedule a task starting on November 1st
- Repeat the task every month there after
- I don't want to run it right at the moment when the task is scheduled only beginning November 1st.
I'm using Agenda.js and I need to make sure that I do this correctly especially Point 3. It cannot run at the moment when it is scheduled.
This is what I have in mind:
const Agenda = require('agenda');
const agenda = new Agenda({db: { address:'mongodb://127.0.0.1/agenda' } });
agenda.define('task', (job, done) => {
console.log('The task is running', job.attrs.hello);
done();
});
agenda.run(() => {
var event = agenda.create('task', { hello: 'world' })
event.schedule(new Date('2017-11-01'));
event.repeatEvery('1 month'); // Will this run every month from now or after 2017-11-01?
agenda.start();
})
However, I'm not sure how would this line behave:
event.repeatEvery('1 month');
Question: Will this run every month from now or after 2017-11-01?