showing results for - "check date clash js"
Valerio
19 Jan 2018
1var date1 = [moment("2016-12-06 11:00"), moment("2016-12-06 12:00")];
2var date2 = [moment("2016-12-06 10:00"), moment("2016-12-06 13:00")];
3
4var range  = moment.range(date1);
5var range2 = moment.range(date2);
6
7// has overlapping
8if(range.overlaps(range2)) {
9    if((range2.contains(range, true) || range.contains(range2, true)) && !date1[0].isSame(date2[0]))
10    alert("time range 1 is completely conflict with time range 2 and vice versa");
11  else
12    alert("time range 1 is partially conflict with time range 2 and vice versa");
13}