You can use the areIntervalsOverlapping
function from the date-fns
library to check if two intervals overlap. Here's an example:
493 chars14 lines
In this example, we use require
to import the areIntervalsOverlapping
function from the date-fns
library. We then define two intervals with start
and end
properties, and use the function to check if they overlap.
The function returns a boolean value true
if the intervals overlap, and false
otherwise.
gistlibby LogSnag