You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
How to get all the dates of occurrences between a defined start and end date?
Checklist
[ y] I have read the documentation.
The documentation shows: later.schedule(schedule).next(count, start, end)
What if I want to find out all possible occurrences between two dates for example:
let sched = later.schedule(later.parse.text("every 2 days on Monday"));
let start = new Date('November 9, 2022 03:24:00');
let end = new Date('December 17, 2022 03:24:00');
let occurrences = sched.next(5, start, end);
console.log(occurrences);
So instead of; let occurrences = sched.next(5, start, end);
is there a way to get all the occurrences between the two dates without limiting them to 5 dates.
I can do a workaround of a loop to check with end date, but I thought there might be a way already.
Thanks
The text was updated successfully, but these errors were encountered:
I came across the same issue. One thing that helps as an easy workaround for others that come across this question would be to just pass Number.POSITIVE_INFINITY as the first argument of next() or prev(). Keep in mind that you'll probably crash your app if you forget to pass in an end date or if the given interval contains a LOT of ocurrences.
What would you like to discuss?
How to get all the dates of occurrences between a defined start and end date?
Checklist
The documentation shows:
later.schedule(schedule).next(count, start, end)
What if I want to find out all possible occurrences between two dates for example:
So instead of;
let occurrences = sched.next(5, start, end);
is there a way to get all the occurrences between the two dates without limiting them to
5
dates.I can do a workaround of a loop to check with end date, but I thought there might be a way already.
Thanks
The text was updated successfully, but these errors were encountered: