Scheduled events are not getting executed in scheduled time

Description
I am using scheduled event script to create an event. When I test it in my local system using URL http://localhost:10001/web/test#
The event is getting executed immediately and function is called instead it should work on the given time

function createTicket(args) {
  console.log('Creating ticket');
}

exports = {
  events: [
    { event: "onScheduledEvent", callback: "onScheduledEventHandler" }
  ],

  createSchedule: function(args) {
    $schedule.create({
      name: "task_reminder2",
      data: {task_id: 100001},
      schedule_at: "2021-11-17T07:43:00.860Z",
    })
    .then(function(data) {
        //"data" is a json with status and message.
        console.log(data);

    }, function(err) {
        //"err" is a json with status and message.
        console.log(err);
    });
  },

  onScheduledEventHandler: function(payload) {
    console.log(new Date);
    createTicket();
  }
}
```

Current Time in output - 2021-11-17T07:40:21.225Z
Scheduled time - 2021-11-17T07:43:21.225Z

Please help on this

Can any one please help on this

As I recall, the handlers attached to a particular schedule are supposed to be invoked immediately in the initial releases for local simulation of scheduled events.

However, in future revisions of the local simulation, there were few updates. Let me check try this locally and get back to you, @franklin .

@franklin - I was able to create schedules successfully. Is there any error specifically that you are seeing?

Can you please let me know what is the time format we should use, now when I use IST time its not working can you please help me with a sample

@franklin

Sorry if I took too long in getting back to you, I used the ISO format as mentioned in the documentation.

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