MCPcopy
hub / github.com/date-fns/date-fns / eachWeekendOfInterval

Function eachWeekendOfInterval

pkgs/core/src/eachWeekendOfInterval/index.ts:59–75  ·  view source on GitHub ↗
(
  interval: IntervalType,
  options?: Options,
)

Source from the content-addressed store, hash-verified

57 * // ]
58 */
59export function eachWeekendOfInterval<
60 IntervalType extends Interval,
61 Options extends EachWeekendOfIntervalOptions | undefined = undefined,
62>(
63 interval: IntervalType,
64 options?: Options,
65): EachWeekendOfIntervalResult<IntervalType, Options> {
66 const { start, end } = normalizeInterval(options?.in, interval);
67 const dateInterval = eachDayOfInterval({ start, end }, options);
68 const weekends: EachWeekendOfIntervalResult<IntervalType, Options> = [];
69 let index = 0;
70 while (index < dateInterval.length) {
71 const date = dateInterval[index++];
72 if (isWeekend(date)) weekends.push(constructFrom(start, date));
73 }
74 return weekends;
75}

Callers 4

eachWeekendOfYearFunction · 0.90
test.tsFile · 0.90
_testFunction · 0.90
eachWeekendOfMonthFunction · 0.90

Calls 4

normalizeIntervalFunction · 0.90
eachDayOfIntervalFunction · 0.90
isWeekendFunction · 0.90
constructFromFunction · 0.90

Tested by

no test coverage detected