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