ical.net
ical.net copied to clipboard
Something like Event.GetOverlappingOccurrences() would be useful
Sometimes you want to find events that overlap with a given search range, as opposed to starting within it.
[Test, Category("Recurrence")]
public void Foo()
{
var iCal = Calendar.LoadFromStream(new StringReader(@"
BEGIN:VCALENDAR
BEGIN:VEVENT
DTSTART:20150816T223000
DTEND:20150821T063000
RRULE:FREQ=WEEKLY;BYDAY=SU
END:VEVENT
END:VCALENDAR
"))[0];
// Missing occurrence is from 10-09 through 10-14, which overlaps 10-11 through 10-17
EventOccurrenceTest(
iCal,
new CalDateTime(2016, 10, 11, _tzid),
new CalDateTime(2016, 10, 17, _tzid),
new[]
{
new CalDateTime(2016, 10, 9, 22, 30, 0, _tzid),
new CalDateTime(2016, 10, 16, 22, 30, 0, _tzid),
},
null
);
}