@mui/x-date-pickers
Version:
The community edition of the Date and Time Picker components (MUI X).
38 lines (37 loc) • 1.07 kB
JavaScript
'use client';
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.useIsDateDisabled = void 0;
var React = _interopRequireWildcard(require("react"));
var _validation = require("../validation");
var _useUtils = require("../internals/hooks/useUtils");
const useIsDateDisabled = ({
shouldDisableDate,
shouldDisableMonth,
shouldDisableYear,
minDate,
maxDate,
disableFuture,
disablePast,
timezone
}) => {
const adapter = (0, _useUtils.useLocalizationContext)();
return React.useCallback(day => (0, _validation.validateDate)({
adapter,
value: day,
timezone,
props: {
shouldDisableDate,
shouldDisableMonth,
shouldDisableYear,
minDate,
maxDate,
disableFuture,
disablePast
}
}) !== null, [adapter, shouldDisableDate, shouldDisableMonth, shouldDisableYear, minDate, maxDate, disableFuture, disablePast, timezone]);
};
exports.useIsDateDisabled = useIsDateDisabled;
;