Skip to content

Commit

Permalink
disable the past and future time by considering date as well
Browse files Browse the repository at this point in the history
  • Loading branch information
shaharyar-shamshi committed Feb 17, 2024
1 parent 0cd3b4f commit dd1bf4b
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions packages/x-date-pickers/src/DigitalClock/DigitalClock.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -230,11 +230,19 @@ export const DigitalClock = React.forwardRef(function DigitalClock<TDate extends
return false;
}

if (disableFuture && isAfter(valueToCheck, now)) {
if (
disableFuture &&
utils.getDate(valueToCheck) === utils.getDate(now) &&
isAfter(valueToCheck, now)
) {
return false;
}

if (disablePast && isAfter(now, valueToCheck)) {
if (
disablePast &&
utils.getDate(valueToCheck) === utils.getDate(now) &&
isAfter(now, valueToCheck)
) {
return false;
}

Expand Down

0 comments on commit dd1bf4b

Please sign in to comment.