Rocky_Mountain_Vending/.pnpm-store/v10/files/8b/e56ee80562eb34fd626f79172595ed5c1348770fd1208f00decd48f76b72efee1cd2a7ad9a0a834513c09ca1f1b26e7c96a0dc0549e1fda5cfce18b69332f4
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

45 lines
No EOL
1.9 KiB
Text

/**
* Calculates the next date that should be focused in the calendar.
*
* This function determines the next focusable date based on the movement
* direction, constraints, and calendar configuration.
*
* @param moveBy The unit of movement (e.g., "day", "week").
* @param moveDir The direction of movement ("before" or "after").
* @param refDate The reference date from which to calculate the next focusable
* date.
* @param navStart The earliest date the user can navigate to.
* @param navEnd The latest date the user can navigate to.
* @param props The DayPicker props, including calendar configuration options.
* @param dateLib The date library to use for date manipulation.
* @returns The next focusable date.
*/
export function getFocusableDate(moveBy, moveDir, refDate, navStart, navEnd, props, dateLib) {
const { ISOWeek, broadcastCalendar } = props;
const { addDays, addMonths, addWeeks, addYears, endOfBroadcastWeek, endOfISOWeek, endOfWeek, max, min, startOfBroadcastWeek, startOfISOWeek, startOfWeek } = dateLib;
const moveFns = {
day: addDays,
week: addWeeks,
month: addMonths,
year: addYears,
startOfWeek: (date) => broadcastCalendar
? startOfBroadcastWeek(date, dateLib)
: ISOWeek
? startOfISOWeek(date)
: startOfWeek(date),
endOfWeek: (date) => broadcastCalendar
? endOfBroadcastWeek(date)
: ISOWeek
? endOfISOWeek(date)
: endOfWeek(date)
};
let focusableDate = moveFns[moveBy](refDate, moveDir === "after" ? 1 : -1);
if (moveDir === "before" && navStart) {
focusableDate = max([navStart, focusableDate]);
}
else if (moveDir === "after" && navEnd) {
focusableDate = min([navEnd, focusableDate]);
}
return focusableDate;
}
//# sourceMappingURL=getFocusableDate.js.map