Rocky_Mountain_Vending/.pnpm-store/v10/files/a6/802e7fb36320cbb5002140a4ce45056995ccc26a6b6cc0bab346dd07489e191dca12749115abb6526f4224499625ae43df4c7d64f6d8b52950e1da04da6eae
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

45 lines
1.5 KiB
Text

import { constructFrom } from "./constructFrom.js";
import { toDate } from "./toDate.js";
import { getDate as coreGetDate } from "./_core/getDate.js";
import { setDate as coreSetDate } from "./_core/setDate.js";
/**
* The {@link addDays} function options.
*/
/**
* @name addDays
* @category Day Helpers
* @summary Add the specified number of days to the given date.
*
* @description
* Add the specified number of days to the given date.
*
* @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).
* @typeParam ResultDate - The result `Date` type, it is the type returned from the context function if it is passed, or inferred from the arguments.
*
* @param date - The date to be changed
* @param amount - The amount of days to be added.
* @param options - An object with options
*
* @returns The new date with the days added
*
* @example
* // Add 10 days to 1 September 2014:
* const result = addDays(new Date(2014, 8, 1), 10)
* //=> Thu Sep 11 2014 00:00:00
*/
export function addDays(date, amount, options) {
const _date = toDate(date, options?.in);
if (isNaN(amount)) return constructFrom(options?.in || date, NaN);
// If 0 days, no-op to avoid changing times in the hour before end of DST
if (!amount) return _date;
coreSetDate(_date, coreGetDate(_date) + amount);
return _date;
}
// Fallback for modularized imports:
export default addDays;