dmfs/lib-recur

Check if date interval overlaps the rule

Opened this issue · 4 comments

Hi, I want to check if my start and end date overlaps the rule. Is there any method avilble which i can use for my scenario?

dmfs commented

Can you be more specific with what you want to accomplish?
At present we don't have any code to intersect rules and dates. Depending on what you're planning it may not be that hard though.

I am developing a resource management tool in which there is a need to check if resource is available on that slot. I have start and end datetime of both the rule and new task. Now i wanted to check if both these dates overlaps or not.

dmfs commented

Ok and by "overlap the rule" do you mean, overlap any of the generated instances or just the overall time range of the rule? I.e. would you consider a pair of start and end to "overlap a rule" if it falls between two of the instances generated by the rule?

What i neant was to overlaps any of the generated instance. This is what i tried, i generted rule next date by specifying the start date(time of the rule and date part from the new event date) and then checked if the generated overlaps the date specified its seems to be working fine. I think i will rephrase the initial question as check if two rules overlap or not?