javascript - Later.js recur every hour not working as intended? -
i'm using later.js recurring events. i'm trying test recur()
function , doesn't seem working properly, , don't know why. here's 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); (var = 0; < 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
,y
values can change;start_day
in format yyyy/mm/dd;start_time
in format hh:mm.
with initial date of 2016/07/20 10:00, x=2 , y=5 following on console:
2016/07/20 10:00 2016/07/20 12:00 2016/07/20 14:00 2016/07/20 16:00 2016/07/20 18:00
so it's working correctly. repeating event every 2 hours, starting @ 10:00 hours repeats 5 times.
however, if change x 8, this:
2016/07/20 16:00 2016/07/21 00:00 2016/07/21 08:00 2016/07/21 16:00 2016/07/22 00:00
why start @ 16:00 now? shouldn't start @ 10:00 before , go 18:00 next?
Comments
Post a Comment