Rocky_Mountain_Vending/.pnpm-store/v10/files/00/035b989f5d1dd4aebfc2017d1cefc378eae985e9f6fde733c5a36778c6ce1dd86ad34b867083a717ddcc1aad03b45d40569c8b6c6f921fd370a133db876c7c
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

64 lines
1.7 KiB
Text

import { type DateLib, defaultDateLib } from "./DateLib.js";
/**
* Represents a day displayed in the calendar.
*
* In DayPicker, a `CalendarDay` is a wrapper around a `Date` object that
* provides additional information about the day, such as whether it belongs to
* the displayed month.
*/
export class CalendarDay {
constructor(
date: Date,
displayMonth: Date,
dateLib: DateLib = defaultDateLib
) {
this.date = date;
this.displayMonth = displayMonth;
this.outside = Boolean(
displayMonth && !dateLib.isSameMonth(date, displayMonth)
);
this.dateLib = dateLib;
}
/**
* Utility functions for manipulating dates.
*
* @private
*/
readonly dateLib: DateLib;
/**
* Indicates whether the day does not belong to the displayed month.
*
* If `outside` is `true`, use `displayMonth` to determine the month to which
* the day belongs.
*/
readonly outside: boolean;
/**
* The month that is currently displayed in the calendar.
*
* This property is useful for determining if the day belongs to the same
* month as the displayed month, especially when `showOutsideDays` is
* enabled.
*/
readonly displayMonth: Date;
/** The date represented by this day. */
readonly date: Date;
/**
* Checks if this day is equal to another `CalendarDay`, considering both the
* date and the displayed month.
*
* @param day The `CalendarDay` to compare with.
* @returns `true` if the days are equal, otherwise `false`.
*/
isEqualTo(day: CalendarDay) {
return (
this.dateLib.isSameDay(day.date, this.date) &&
this.dateLib.isSameMonth(day.displayMonth, this.displayMonth)
);
}
}