c# - Algorithm to detect overlapping recurent time periods -


i'm trying detect event's colision depending of days recurrency , timetable.

a version more complex issue algorithm detect overlapping periods.

my case : event 8am 1pm tuesday, thurday , saturday, between 2 dates.

the b event 11am 2pm tuesday , thurday, between 2 dates(differents of event a)

here, putted in red colisions between 2 events.

i spent hour trying write algorithm detect if there @ least 1 colision between 2 event.

by way date of end of event (tend) can undeterminate.

is there existing algorithm manage this?

enter image description here

figure out 1 ends first. if both , b unlimited pick random date in future.

i'm going assume events repeat on weekly basis (every week there's same recurring times). if that's not true replace week largest repeting basis (month/year/whatever).

take last week before date picked in first step. generate events happen week (make sure checks, since 1 of events might start repeating in period. each event should have concrete timestamp start , end. check if these overlap. if @ least of them have collision. if not you're good.


Comments

Popular posts from this blog

ruby - Trying to change last to "x"s to 23 -

jquery - Clone last and append item to closest class -

c - Unrecognised emulation mode: elf_i386 on MinGW32 -