Combine 3 .ics calendars into one without overlapping events

24 Views Asked by At

Context

We have 3 independent ics calendars. One is for events of type A, one for events of type B and the third one for events of type C. Each of these calendars may contain recurring or all day events. The A calendar has the lowest priority, while the C calendar has the highest priority. Events in respective calendars can be overlapping to events in another calendar.

Question

How can I combine these 3 calendars into one, while there will be no overlapping events, while also keeping the time complexity relatively low? Would I go day by day until I exhaust the events from all 3 callendars (or end up on recurring events without end date, i.e. indefinitelly recurring events) could be somehow timeconsuming to do, upon user request, so I am looking for a more effective approach.

Other which I think could be better is to precalculate the "merge" calendar on each change in any of the 3 incoming calendars, which would be better, but I am looking if there is no other simpler solution.

0

There are 0 best solutions below