temporal-fns
API reference

eachWeekendOfInterval

API index · Input types and conventions · Installation

eachWeekendOfInterval(interval, options?) → same-kind array

Enumerate containing day starts whose weekdays appear in weekendDays, for PlainDate, PlainDateTime, or ZonedDateTime endpoints. Defaults to Saturday and Sunday. Accepts weekendDays only; there is no step option. No matching dates returns [].

import { eachWeekendOfInterval } from '@frantss/temporal-fns';

const interval = {
  start: Temporal.PlainDate.from('2026-10-23'),
  end: Temporal.PlainDate.from('2026-10-27'),
};
eachWeekendOfInterval(interval).map((value) => value.toString()); // => ['2026-10-24', '2026-10-25']
eachWeekendOfInterval(interval, { weekendDays: [5, 6] }).map((value) => value.toString()); // => ['2026-10-23', '2026-10-24']
eachWeekendOfInterval(interval, { weekendDays: [] }); // => []

Related: isWeekend, eachDayOfInterval, addBusinessDays.

Behaviors: SEQ-006: Weekend sequences filter containing days by weekendDays; SEQ-014: Calendar day sequences omit dates that never occurred; SEQ-021: Sequence configuration shares the week and weekend constraints; SEQ-024: Weekend filtering does not require a weekend to occur; BUS-017: All weekend consumers validate a configuration with no working day.