lib-recur icon indicating copy to clipboard operation
lib-recur copied to clipboard

Check if date interval overlaps the rule

Open haiderali22 opened this issue 4 years ago • 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?

haiderali22 avatar Dec 11 '20 07:12 haiderali22

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.

dmfs avatar Dec 11 '20 11:12 dmfs

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.

haiderali22 avatar Dec 11 '20 18:12 haiderali22

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?

dmfs avatar Dec 12 '20 14:12 dmfs

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?

haiderali22 avatar Dec 12 '20 15:12 haiderali22