How can I schedule according to fixed data and time with specific timezone.
I tried but didn't work.
const scheduleDate = '2018-7-24 10:18:40';
agenda.schedule(scheduleDate, {timezone}, 'some jobs')
Same problem here.
I'm in Europe (Paris timezone so, now it's +2)
I use momentJs to format my date.
If i want my job executing today, in 10 minutes
var date = moment().add(10,'m').format()
agenda.schedule(date, 'hello world')
But the job is fire right instantly and not in 10 minutes after.
same thing if i write manually the date
2018-07-30T15:55:05+02:00
the job is fire instantly.
Very very annoying!
From what I can tell from only reading the readme, timezones only works with repeatEvery(). Why not just use moment timezone to work with the time then convert it to UTC when scheduling the job? (I'm pretty sure toDate() returns a date object with is always in UTC)
const moment = require("moment-timezone");
const timezone = "America/Chicago";
const date = moment.tz(timezone).add(10,'m').toDate()
agenda.schedule(date, 'hello world')
Yes, scheduling at UTC times would be wise.
But the job is fire right instantly and not in 10 minutes after.
There's a new skipImmediate option for scheduling recurring jobs. See README.md for details
Hope his helps!
Most helpful comment
Yes, scheduling at UTC times would be wise.
There's a new
skipImmediateoption for scheduling recurring jobs. See README.md for detailsHope his helps!