Skip to main content
Deno 2 is finally here 🎉️
Learn more
Go to Latest
function getOverlappingDaysInIntervals
import { getOverlappingDaysInIntervals } from "https://deno.land/x/date_fns@v2.12.0/index.js";

Examples

// For overlapping time intervals adds 1 for each started overlapping day: getOverlappingDaysInIntervals( { start: new Date(2014, 0, 10), end: new Date(2014, 0, 20) }, { start: new Date(2014, 0, 17), end: new Date(2014, 0, 21) } ) //=> 3

// For non-overlapping time intervals returns 0: getOverlappingDaysInIntervals( { start: new Date(2014, 0, 10), end: new Date(2014, 0, 20) }, { start: new Date(2014, 0, 21), end: new Date(2014, 0, 22) } ) //=> 0

Parameters

dirtyIntervalLeft
  • the first interval to compare. See [Interval]docs/Interval
dirtyIntervalRight
  • the second interval to compare. See [Interval]docs/Interval