Rocky_Mountain_Vending/.pnpm-store/v10/files/1a/fe3c470aa9bcea9b6176d87c98b39dbdc55333bc4db60a35785a057cdbf8f0d26634f66a89b877e7cbcbe608e66e1d90d34d9c32bf82780e489d4cd80f156d
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

29 lines
915 B
Text

import type { DateArg } from "./types.js";
/**
* @name closestIndexTo
* @category Common Helpers
* @summary Return an index of the closest date from the array comparing to the given date.
*
* @description
* Return an index of the closest date from the array comparing to the given date.
*
* @param dateToCompare - The date to compare with
* @param dates - The array to search
*
* @returns An index of the date closest to the given date or undefined if no valid value is given
*
* @example
* // Which date is closer to 6 September 2015?
* const dateToCompare = new Date(2015, 8, 6)
* const datesArray = [
* new Date(2015, 0, 1),
* new Date(2016, 0, 1),
* new Date(2017, 0, 1)
* ]
* const result = closestIndexTo(dateToCompare, datesArray)
* //=> 1
*/
export declare function closestIndexTo(
dateToCompare: DateArg<Date> & {},
dates: Array<DateArg<Date> & {}>,
): number | undefined;