Rocky_Mountain_Vending/.pnpm-store/v10/files/b3/a86cccb5fc91aa607372a9fe24368c6e78a7ea0badd382097914058bbdf08813f20d9d74e7aaba5082c1e61bf51b5a4ecbc36904afee134b4f8929eb45e3f9
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

37 lines
No EOL
1.3 KiB
Text

/**
* Returns the years to display in the dropdown.
*
* This function generates a list of years between the navigation start and end
* dates, formatted using the provided formatter.
*
* @param navStart The start date for navigation.
* @param navEnd The end date for navigation.
* @param formatters The formatters to use for formatting the year labels.
* @param dateLib The date library to use for date manipulation.
* @returns An array of dropdown options representing the years, or `undefined`
* if `navStart` or `navEnd` is not provided.
*/
export function getYearOptions(navStart, navEnd, formatters, dateLib) {
if (!navStart)
return undefined;
if (!navEnd)
return undefined;
const { startOfYear, endOfYear, addYears, getYear, isBefore, isSameYear } = dateLib;
const firstNavYear = startOfYear(navStart);
const lastNavYear = endOfYear(navEnd);
const years = [];
let year = firstNavYear;
while (isBefore(year, lastNavYear) || isSameYear(year, lastNavYear)) {
years.push(year);
year = addYears(year, 1);
}
return years.map((year) => {
const label = formatters.formatYearDropdown(year, dateLib);
return {
value: getYear(year),
label,
disabled: false
};
});
}
//# sourceMappingURL=getYearOptions.js.map