agenda / agenda

Lightweight job scheduling for Node.js
http://agendajs.com
Other
9.41k stars 800 forks source link

Agenda is not working with timeZone of "Asia/Karachi" !! If we set timeZone as "Asia/Karachi" in repeatEvery, it is still taking "UTC" timezone #1435

Open hamza3492 opened 2 years ago

hamza3492 commented 2 years ago

Is there any way to resolve this issue, I have created a cron job with repeatEvery, and set timezone as "Asia/Karachi" , timezone updated in database but it is still taking "UTC" timezone for nextRunAt.

simllll commented 2 years ago

agenda uses luxon (https://github.com/moment/luxon) can you check if it's supported by luxon? It's weird that it's using UTC then instead, for my use cases where we had e.g. a typo in the timezone, it actually returned some weird error when calculating the nuxtRunAt date.

Can you add your excact repeatEvery call? Are you using a cron expression or a human interval?

hamza3492 commented 2 years ago

I am using cron job with repeatEvery, code is below.

if (options.cron) { job.repeatEvery( options.cron, { skipImmediate: false, timezone: Intl.DateTimeFormat().resolvedOptions().timeZone // timezone: 'Asia/Karachi' } ); }

simllll commented 2 years ago

alright, in this case it uses https://www.npmjs.com/package/cron-parser which also uses luxon behind the scene. so please check directly with the luxon library what's going on in this case! Maybe you can open an issue over there and link it over here?

LorianeE commented 1 month ago

@hamza3492 I know it's been a long time since this issue, but I have the exact same problem as you, and wonder if you manage to find why it happened and do you have a fix/workaround? Thanks!