Rocky_Mountain_Vending/.pnpm-store/v10/files/49/30f1d37f2ae721b9d892ae109ccb0762e5ebbe169fd8a06b4a69b8fc3ae00fd9842c630a1daa0d7c22ef9d5fbfd210c620192c507188921074e67953a5b05c
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

39 lines
No EOL
1.5 KiB
Text

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getPreviousMonth = getPreviousMonth;
/**
* Returns the previous month the user can navigate to, based on the given
* options.
*
* The previous month is not always the previous calendar month:
*
* - If it is before the `calendarStartMonth`, it returns `undefined`.
* - If paged navigation is enabled, it skips back by the number of displayed
* months.
*
* @param firstDisplayedMonth The first month currently displayed in the
* calendar.
* @param calendarStartMonth The earliest month the user can navigate to.
* @param options Navigation options, including `numberOfMonths` and
* `pagedNavigation`.
* @param dateLib The date library to use for date manipulation.
* @returns The previous month, or `undefined` if navigation is not possible.
*/
function getPreviousMonth(firstDisplayedMonth, calendarStartMonth, options, dateLib) {
if (options.disableNavigation) {
return undefined;
}
const { pagedNavigation, numberOfMonths } = options;
const { startOfMonth, addMonths, differenceInCalendarMonths } = dateLib;
const offset = pagedNavigation ? (numberOfMonths ?? 1) : 1;
const month = startOfMonth(firstDisplayedMonth);
if (!calendarStartMonth) {
return addMonths(month, -offset);
}
const monthsDiff = differenceInCalendarMonths(month, calendarStartMonth);
if (monthsDiff <= 0) {
return undefined;
}
return addMonths(month, -offset);
}
//# sourceMappingURL=getPreviousMonth.js.map