Rocky_Mountain_Vending/.pnpm-store/v10/files/fa/64f15cb7a85653a5f2149c34916557add8b9f37c7b332d7a0c38fa11a3b65e1b3c4749d7eec3a82b8c1d2b2a17a8b0860c77852b224f7cae204d42f3210e02
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

38 lines
No EOL
1.4 KiB
Text

import { defaultDateLib } from "../classes/index.js";
/**
* Checks if a given date is within a specified date range.
*
* @since 9.0.0
* @param range - The date range to check against.
* @param date - The date to check.
* @param excludeEnds - If `true`, the range's start and end dates are excluded.
* @param dateLib - The date utility library instance.
* @returns `true` if the date is within the range, otherwise `false`.
* @group Utilities
*/
export function rangeIncludesDate(range, date, excludeEnds = false, dateLib = defaultDateLib) {
let { from, to } = range;
const { differenceInCalendarDays, isSameDay } = dateLib;
if (from && to) {
const isRangeInverted = differenceInCalendarDays(to, from) < 0;
if (isRangeInverted) {
[from, to] = [to, from];
}
const isInRange = differenceInCalendarDays(date, from) >= (excludeEnds ? 1 : 0) &&
differenceInCalendarDays(to, date) >= (excludeEnds ? 1 : 0);
return isInRange;
}
if (!excludeEnds && to) {
return isSameDay(to, date);
}
if (!excludeEnds && from) {
return isSameDay(from, date);
}
return false;
}
/**
* @private
* @deprecated Use {@link rangeIncludesDate} instead.
*/
export const isDateInRange = (range, date) => rangeIncludesDate(range, date, false, defaultDateLib);
//# sourceMappingURL=rangeIncludesDate.js.map