vremel
Version:
JavaScript date utility library for Temporal API
33 lines • 1.19 kB
TypeScript
import type { Interval } from "../types.js";
export interface AreIntervalsOverlappingOptions {
/**
* Whether the comparison is inclusive or not. Default is `true`.
*/
inclusive?: boolean;
}
/**
* Checks if the given two intervals are overlapping.
* By default, it returns `true` if the end of one interval is exactly same time to the start of the other interval.
* You can pass the `inclusive` option to change this behavior.
*
* @example
* ```typescript
* const interval1 = {
* start: Temporal.PlainTime.from("00:00:00"),
* end: Temporal.PlainTime.from("08:00:00"),
* };
* const interval2 = {
* start: Temporal.PlainTime.from("08:00:00"),
* end: Temporal.PlainTime.from("16:00:00"),
* };
* areIntervalsOverlapping(interval1, interval2); // true
* areIntervalsOverlapping(interval1, interval2, { inclusive: false }); // false
* ```
*
* @param interval1
* @param interval2
* @param options
* @returns Whether two intervals are overlapping
*/
export declare function areIntervalsOverlapping(interval1: Interval, interval2: Interval, options?: AreIntervalsOverlappingOptions): boolean;
//# sourceMappingURL=areIntervalsOverlapping.d.ts.map