Agenda: Schedule by specific date and time

Created on 24 Jul 2018  路  3Comments  路  Source: agenda/agenda

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')

Most helpful comment

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!

All 3 comments

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!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

niftylettuce picture niftylettuce  路  6Comments

ekegodigital picture ekegodigital  路  3Comments

nhan-pt picture nhan-pt  路  4Comments

exislow picture exislow  路  5Comments

0x62 picture 0x62  路  6Comments