12345678910111213141516171819202122232425262728293031323334353637383940 |
- import type { Interval } from "./types.js";
- /**
- * @name getOverlappingDaysInIntervals
- * @category Interval Helpers
- * @summary Get the number of days that overlap in two time intervals
- *
- * @description
- * Get the number of days that overlap in two time intervals. It uses the time
- * between dates to calculate the number of days, rounding it up to include
- * partial days.
- *
- * Two equal 0-length intervals will result in 0. Two equal 1ms intervals will
- * result in 1.
- *
- * @param intervalLeft - The first interval to compare.
- * @param intervalRight - The second interval to compare.
- * @param options - An object with options
- *
- * @returns The number of days that overlap in two time intervals
- *
- * @example
- * // 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
- *
- * @example
- * // 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
- */
- export declare function getOverlappingDaysInIntervals(
- intervalLeft: Interval,
- intervalRight: Interval,
- ): number;
|