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>
32 lines
1 KiB
Text
32 lines
1 KiB
Text
import { DateLib } from "../classes/DateLib.js";
|
|
|
|
/**
|
|
* Generates a series of 7 days, starting from the beginning of the week, to use
|
|
* for formatting weekday names (e.g., Monday, Tuesday, etc.).
|
|
*
|
|
* @param dateLib The date library to use for date manipulation.
|
|
* @param ISOWeek Whether to use ISO week numbering (weeks start on Monday).
|
|
* @param broadcastCalendar Whether to use the broadcast calendar (weeks start
|
|
* on Monday, but may include adjustments for broadcast-specific rules).
|
|
* @returns An array of 7 dates representing the weekdays.
|
|
*/
|
|
export function getWeekdays(
|
|
dateLib: DateLib,
|
|
ISOWeek?: boolean | undefined,
|
|
broadcastCalendar?: boolean | undefined
|
|
): Date[] {
|
|
const today = dateLib.today();
|
|
|
|
const start = broadcastCalendar
|
|
? dateLib.startOfBroadcastWeek(today, dateLib)
|
|
: ISOWeek
|
|
? dateLib.startOfISOWeek(today)
|
|
: dateLib.startOfWeek(today);
|
|
|
|
const days: Date[] = [];
|
|
for (let i = 0; i < 7; i++) {
|
|
const day = dateLib.addDays(start, i);
|
|
days.push(day);
|
|
}
|
|
return days;
|
|
}
|