Hi there! Are you looking for the official Deno documentation? Try docs.deno.com for all your Deno learning needs.

areIntervalsOverlapping

import { areIntervalsOverlapping } from "https://esm.sh/v135/date-fns@3.6.0/index.d.mts";
@example
// For overlapping time intervals:
areIntervalsOverlapping(
  { start: new Date(2014, 0, 10), end: new Date(2014, 0, 20) },
  { start: new Date(2014, 0, 17), end: new Date(2014, 0, 21) }
)
//=> true
@example
// For non-overlapping time intervals:
areIntervalsOverlapping(
  { start: new Date(2014, 0, 10), end: new Date(2014, 0, 20) },
  { start: new Date(2014, 0, 21), end: new Date(2014, 0, 22) }
)
//=> false
@example
// For adjacent time intervals:
areIntervalsOverlapping(
  { start: new Date(2014, 0, 10), end: new Date(2014, 0, 20) },
  { start: new Date(2014, 0, 20), end: new Date(2014, 0, 30) }
)
//=> false
@example
// Using the inclusive option:
areIntervalsOverlapping(
  { start: new Date(2014, 0, 10), end: new Date(2014, 0, 20) },
  { start: new Date(2014, 0, 20), end: new Date(2014, 0, 24) }
)
//=> false
@example
areIntervalsOverlapping(
  { start: new Date(2014, 0, 10), end: new Date(2014, 0, 20) },
  { start: new Date(2014, 0, 20), end: new Date(2014, 0, 24) },
  { inclusive: true }
)
//=> true
function areIntervalsOverlapping(
intervalLeft: Interval,
intervalRight: Interval,
): boolean;
§
areIntervalsOverlapping(intervalLeft: Interval, intervalRight: Interval, options?: AreIntervalsOverlappingOptions): boolean
[src]

§Parameters

§
intervalLeft: Interval
[src]
  • The first interval to compare.
§
intervalRight: Interval
[src]
  • The second interval to compare.
§
  • The object with options

§Return Type

§
boolean
[src]

Whether the time intervals are overlapping