UNPKG

@mui/x-date-pickers

Version:

The community edition of the Date and Time Picker components (MUI X).

31 lines (30 loc) 791 B
'use client'; import * as React from 'react'; import { validateDate } from "../validation/index.js"; import { useLocalizationContext } from "../internals/hooks/useUtils.js"; export const useIsDateDisabled = ({ shouldDisableDate, shouldDisableMonth, shouldDisableYear, minDate, maxDate, disableFuture, disablePast, timezone }) => { const adapter = useLocalizationContext(); return React.useCallback(day => validateDate({ adapter, value: day, timezone, props: { shouldDisableDate, shouldDisableMonth, shouldDisableYear, minDate, maxDate, disableFuture, disablePast } }) !== null, [adapter, shouldDisableDate, shouldDisableMonth, shouldDisableYear, minDate, maxDate, disableFuture, disablePast, timezone]); };