buildDisabledPredicate

Calendar
stable

Factory that normalises the disabledDates prop (array of Date | string, or a custom predicate) into a single (date: Date) => boolean function consumed by calendar cell builders.

API

Signature

Full TypeScript signature sourced from the util file.

typescript

API

Parameters

Input parameters accepted by this util.

input
required
Array<Date | string> | ((d: Date) => boolean) | undefined
Disabled dates as an array of Date / ISO string values, a custom predicate function, or undefined. When undefined, the returned predicate always returns false.

API

Return value

The value returned by this util.

A single predicate that returns true for any date that should be disabled in the calendar.

Usage

Examples

Ready-to-paste usage snippets.

Disable specific dates from an array

typescript

Pass a custom predicate directly

typescript