Let's say, I have two date intervals, 09:00 - 16:00 and 13:00 - 18:00. I want to check, if the two intervals have any common time. The above example has, the 13:00-16:00.
Data structure of intervals is something like this:
{
"begin": 324872,
"end": 532424
}
So there is a shift, and I want to check if a person was working on that shift, or not:
if(shift.Begin <= personWorkBegin && shift.End >= personWorkBegin)
But this is not a solution, since it has to be inside that interval, and I just want to check common parts.