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.
I'm using Later.js for recurring events. I'm trying to test the recur() function and it doesn't seem to be working properly, and I don't know why. Here's my example:
var schedule_hourly = later.schedule(later.parse.recur().every(x).hour()),
start_hourly = moment(start_day + " " + start_time, 'YYYY/MM/DD HH:mm');
var occurrences_hourly = schedule_hourly.next(y, start_hourly);
for (var i = 0; i < occurrences_hourly.length; i++) {
var execution_dates_hourly = [];
execution_dates_hourly = moment(occurrences_hourly[i]).format('YYYY/MM/DD HH:mm');
console.log(execution_dates_hourly);
}
Where:
x and y are values that I can change;
start_day is in the format YYYY/MM/DD;
start_time is in the format HH:mm.
With an initial date of 2016/07/20 10:00, x=2 and y=5 I get the following on the console:
I'm using Later.js for recurring events. I'm trying to test the recur() function and it doesn't seem to be working properly, and I don't know why. Here's my example:
Where:
x
andy
are values that I can change;start_day
is in the format YYYY/MM/DD;start_time
is in the format HH:mm.With an initial date of 2016/07/20 10:00, x=2 and y=5 I get the following on the console:
So it's working correctly. I get a repeating event every 2 hours, starting at 10:00 hours that repeats 5 times.
However, if I change the x to 8, I get this:
Why does it start at 16:00 now? Shouldn't it start at 10:00 like before and go to 18:00 next?