isWithinInterval
import { isWithinInterval } from "https://esm.sh/v135/date-fns@3.6.0/index.d.mts";
@example
// For the date within the interval:
isWithinInterval(new Date(2014, 0, 3), {
start: new Date(2014, 0, 1),
end: new Date(2014, 0, 7)
})
//=> true
@example
// For the date outside of the interval:
isWithinInterval(new Date(2014, 0, 10), {
start: new Date(2014, 0, 1),
end: new Date(2014, 0, 7)
})
//=> false
@example
// For date equal to interval start:
isWithinInterval(date, { start, end: date })
// => true
@example
// For date equal to interval end:
isWithinInterval(date, { start: date, end })
// => true
function isWithinInterval<DateType extends Date>(date: DateType | number | string, interval: Interval<DateType>): boolean;