31 lines
No EOL
777 B
JavaScript
31 lines
No EOL
777 B
JavaScript
'use client';
|
|
|
|
import * as React from 'react';
|
|
import { validateDate } from "../validation/index.js";
|
|
import { usePickerAdapter } from "../hooks/usePickerAdapter.js";
|
|
export const useIsDateDisabled = ({
|
|
shouldDisableDate,
|
|
shouldDisableMonth,
|
|
shouldDisableYear,
|
|
minDate,
|
|
maxDate,
|
|
disableFuture,
|
|
disablePast,
|
|
timezone
|
|
}) => {
|
|
const adapter = usePickerAdapter();
|
|
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]);
|
|
}; |