jkbrzt / rrule

JavaScript library for working with recurrence rules for calendar dates as defined in the iCalendar RFC and more.
https://jkbrzt.github.io/rrule
Other
3.33k stars 511 forks source link

REQ: function to return if a ruleset (or rule) is endless #215

Open grebulon opened 6 years ago

grebulon commented 6 years ago

Loop over the rules in a set and return true if at least one of the rules is endless. Optionally, return the date of the final recurrence of the set.

bibobibo commented 5 years ago

How is this going?

bibobibo commented 5 years ago

If a rrule has no until nor count, does that mean it is an endless rrule?

davidgoli commented 5 years ago

If an rrule has an until or count, it is definitely not endless. Can you think of any case where the inverse is true?

Ie, is there some combination of rule statements eg. byweekno, bysetpos, byweekday, byyearday that results in a finite set of dates? If so, then simply checking for the presence of count and until is not sufficient, and the problem becomes much more complex.

But I am not sure such a combination exists. Given that time is infinite, any combination of rules, no matter how sparse, is bound to have an unlimited number of recurrences.

So I think checking for those properties is probably OK.

I am not actively working on this feature, but would consider a PR that follows our PR guidelines.