Files
avz-site/node_modules/react-day-picker/dist/esm/helpers/endOfBroadcastWeek.js
T
2026-05-30 19:59:39 -03:00

20 lines
788 B
JavaScript

import { getBroadcastWeeksInMonth } from "./getBroadcastWeeksInMonth.js";
import { startOfBroadcastWeek } from "./startOfBroadcastWeek.js";
/**
* Returns the end date of the week in the broadcast calendar.
*
* The broadcast week ends on the last day of the last broadcast week for the
* given date.
*
* @since 9.4.0
* @param date The date for which to calculate the end of the broadcast week.
* @param dateLib The date library to use for date manipulation.
* @returns The end date of the broadcast week.
*/
export function endOfBroadcastWeek(date, dateLib) {
const startDate = startOfBroadcastWeek(date, dateLib);
const numberOfWeeks = getBroadcastWeeksInMonth(date, dateLib);
const endDate = dateLib.addDays(startDate, numberOfWeeks * 7 - 1);
return endDate;
}