- 🚀 all instances (hooks, data types, etc) get new types with
DP
namespace and all hooks and functions got explicit return types - 🆕 Exclude configuration for
day
anddate
- 🛠️ internal optimizations
With the new Exclude configuration you can mark days and dates as disabled.
Types:
// The days in JS Date object has numbers from 0 - Sun to 6 - Sat
type DPDayInteger = 0 | 1 | 2 | 3 | 4 | 5 | 6;
export interface DPExcludeConfig {
day?: DPDayInteger[];
date?: Date[];
}
- exclude days, example below will disable all Saturdays and Sundays
const { calendars } = useDatePicker({ exclude: { day: [0, 6] })
- exclude date, the example below will disable Dec 31 2023 and Jan 1 2024 (that's how you can mark holidays)
const { calendars } = useDatePicker({ exclude: { date: [new Date(2023, 11, 31), new Date(2024, 0, 1)] });