Unable to set scheduler in time zone

Hi Team,

I have developed a custom application in Freshdesk that uses a scheduler in the background to update the ticket once a day.

This has to happen every day at 6 AM in Australia/Sydney time zone. I had set the time zone and scheduled the recurring scheduler to run at 6 AM the following day. Once it has run that day. The next day it seems to reset itself to UTC and runs the start of the day UTC.

OnAppInstall

moment.tz.setDefault("Australia/Sydney");
const dateTime = moment().add(1, "day").startOf("day").add(6, "hour");

OnScheduledEvent

$schedule.create({
  name: "set_reopen",
  data: { initialize: 1 },
  schedule_at: timeAt,
  repeat: { time_unit: "hours", frequency: 24 },
}).then(function (data) {
  console.log(data);
}, (err) => console.log(err));

I’m not sure why is this happening and if is there any mistake that I’m making. Thanks in advance.

Hi @mohammed,

Greetings!

Just for the record, this is not an issue or a bug, as per the documentation, the scheduler will use UTC formate dates.

You would have to do the math manually to subtract the time difference.
If you need any further assistance let us know :wink:

Now, instead of hours try using the days
As the note says, I guess this would match your case.

Hope this helps!

Thank you.

2 Likes

Hi @Bene_Immanuel,

Thanks for your reply. I want the application to run every day morning at 6 AM in the Australian time zone (AEST).
For that, i would have to change the frequency from 24 hours to 1 day and run the scheduler at 7 PM the previous day in UTC for the app to run at 6 AM in AEST since AEST is 11 hours ahead of UTC.

Please confirm if my understanding is correct.

Thanks & Regards
Sarfaraz

Yes, Sarfaraz, your understanding is correct. (~13 hours for AEDT).

1 Like

This topic was automatically closed 6 days after the last reply. New replies are no longer allowed.