breejs / later

*Maintained fork of Later.* A javascript library for defining recurring schedules and calculating future (or past) occurrences for them. Includes support for using English phrases and Cron schedules. Works in Node and in the browser.
https://breejs.github.io/later/
MIT License
134 stars 13 forks source link

[fix] later.setInterval is advancing 3 hours #25

Open eduardokreve opened 2 years ago

eduardokreve commented 2 years ago

Describe the bug

I'm using the following code snippet to schedule a routine that runs daily on the same hour later.parse.recur().every(1).dayOfMonth().on(10).hour().on(33).minute(); through the later.setInterval

Actual behavior

The execution takes place well for 2 days, but in the 3rd execution it is executed 3 hours in advance.

...

Expected behavior

I expect setInterval to run daily at the same time every day

...

Code to reproduce


let routine = later.parse.recur().every(1).dayOfMonth().on(10).hour().on(33).minute();

//JSON.stringify -> {"schedules":[{"D":[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31],"h":[10],"m":[33]}],"exceptions":[]}

later.setInterval(function() {execRoutine(data)}, routine, timeZone); //timezone = "America/Sao_Paulo"
...

Checklist

eduardokreve commented 2 years ago

I have several routines scheduled this way, and only a few had no problem executing in advance.