Asked by Davide9 years ago.
Hi,
is there a javascript method to check if two child events with different parent are overlapping?
Via code (js) i'm able to retreive this two events during resizing event of one of them but it's quite difficult to check if the are overlapping using each start and time.
Thank you.
Davide
Answer posted by Davide9 years ago.
Found a solution:
dc = dp.resources[x].children[y].id;
var dcStart = dp.events.find(dc).data.start;
var dcEnd = dp.events.find(dc).data.end;
var deStart = args.start.addMinutes(30);
var deEnd = args.end.addMinutes(-30);
if (dcStart >= deStart && dcStart <= deEnd || deStart >= dcStart && deStart <= dcEnd)
--> OVERLAP
Hope this could help someone.
Bye
Davide
Comment posted by Dan Letecky [DayPilot]9 years ago.
Thanks for posting the solution.
DayPilot includes a helper method that checks an overlap:
var overlaps = DayPilot.Util.overlaps(start1, end1, start2, end2);
Comment posted by Davide9 years ago.
It works and it is simpler than my solution!
Thank you!
Davide
This question is more than 1 month old and has been closed. Please create a new question if you have anything to add.