Rocky_Mountain_Vending/.pnpm-store/v10/files/13/40040fb9c185c6b97e033aca9de39ad9e54784cff07b4b79e7556fe3b8104aade1754e82288f393ec7476932e4077a0eb7631a05f03cf09824edc2f15adc30
DMleadgen 46d973904b
Initial commit: Rocky Mountain Vending website
Next.js website for Rocky Mountain Vending company featuring:
- Product catalog with Stripe integration
- Service areas and parts pages
- Admin dashboard with Clerk authentication
- SEO optimized pages with JSON-LD structured data

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-12 16:22:15 -07:00

30 lines
1,005 B
Text

import type { DateLib } from "../classes/DateLib.js";
import type { DayPickerProps } from "../types/index.js";
/**
* Returns the months to display in the calendar.
*
* @param firstDisplayedMonth The first month currently displayed in the
* calendar.
* @param calendarEndMonth The latest month the user can navigate to.
* @param props The DayPicker props, including `numberOfMonths`.
* @param dateLib The date library to use for date manipulation.
* @returns An array of dates representing the months to display.
*/
export function getDisplayMonths(
firstDisplayedMonth: Date,
calendarEndMonth: Date | undefined,
props: Pick<DayPickerProps, "numberOfMonths">,
dateLib: DateLib
): Date[] {
const { numberOfMonths = 1 } = props;
const months: Date[] = [];
for (let i = 0; i < numberOfMonths; i++) {
const month = dateLib.addMonths(firstDisplayedMonth, i);
if (calendarEndMonth && month > calendarEndMonth) {
break;
}
months.push(month);
}
return months;
}