( interval: IntervalType, options?: Options, )
| 57 | * // ] |
| 58 | */ |
| 59 | export 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 | } |
no test coverage detected