1+ import { dateLib as defaultDateLib } from "../lib/dateLib.js" ;
12import type { DateLib , Matcher } from "../types/index.js" ;
23
34import { rangeIncludesDate } from "./rangeIncludesDate.js" ;
@@ -15,7 +16,7 @@ import {
1516 * {@link Matcher}.
1617 *
1718 * ```tsx
18- * const day = new Date(2022, 5, 19);
19+ * const date = new Date(2022, 5, 19);
1920 * const matcher1: DateRange = {
2021 * from: new Date(2021, 12, 21),
2122 * to: new Date(2021, 12, 30)
@@ -24,15 +25,15 @@ import {
2425 * from: new Date(2022, 5, 1),
2526 * to: new Date(2022, 5, 23)
2627 * }
27- * const isMatch(day , [matcher1, matcher2]); // true, since day is in the matcher1 range.
28+ * const dateMatchModifiers(date , [matcher1, matcher2]); // true, since day is in the matcher1 range.
2829 * ```
2930 *
3031 * @group Utilities
3132 */
3233export function dateMatchModifiers (
3334 date : Date ,
3435 matchers : Matcher | Matcher [ ] ,
35- dateLib : DateLib
36+ dateLib : DateLib = defaultDateLib
3637) : boolean {
3738 const matchersArr = ! Array . isArray ( matchers ) ? [ matchers ] : matchers ;
3839 const { isSameDay, differenceInCalendarDays, isAfter } = dateLib ;
@@ -79,3 +80,9 @@ export function dateMatchModifiers(
7980 return false ;
8081 } ) ;
8182}
83+
84+ /**
85+ * @private
86+ * @deprecated Use {@link dateMatchModifiers} instead.
87+ */
88+ export const isMatch = dateMatchModifiers ;
0 commit comments