Skip to content

Commit

Permalink
Fix #3192: Calendar monthpicker fix for disabled dates (#3195)
Browse files Browse the repository at this point in the history
  • Loading branch information
melloware authored Aug 26, 2022
1 parent 635aeed commit 614628f
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions components/lib/calendar/Calendar.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import { Button } from '../button/Button';
import { useMountEffect, useOverlayListener, usePrevious, useUnmountEffect, useUpdateEffect } from '../hooks/Hooks';
import { InputText } from '../inputtext/InputText';
import { OverlayService } from '../overlayservice/OverlayService';
import { DomHandler, ObjectUtils, classNames, mask, ZIndexUtils, UniqueComponentId } from '../utils/Utils';
import { Ripple } from '../ripple/Ripple';
import { classNames, DomHandler, mask, ObjectUtils, UniqueComponentId, ZIndexUtils } from '../utils/Utils';
import { CalendarPanel } from './CalendarPanel';

export const Calendar = React.memo(
Expand Down Expand Up @@ -1681,7 +1681,7 @@ export const Calendar = React.memo(
if (props.minDate.getMonth() > month) {
validMin = false;
} else if (props.minDate.getMonth() === month) {
if (props.minDate.getDate() > day) {
if (day > 0 && props.minDate.getDate() > day) {
validMin = false;
}
}
Expand All @@ -1695,7 +1695,7 @@ export const Calendar = React.memo(
if (props.maxDate.getMonth() < month) {
validMax = false;
} else if (props.maxDate.getMonth() === month) {
if (props.maxDate.getDate() < day) {
if (day > 0 && props.maxDate.getDate() < day) {
validMax = false;
}
}
Expand Down Expand Up @@ -3031,7 +3031,7 @@ export const Calendar = React.memo(
<div className="p-monthpicker">
{monthPickerValues().map((m, i) => {
return (
<span onClick={(event) => onMonthSelect(event, i)} key={`month${i + 1}`} className={classNames('p-monthpicker-month', { 'p-highlight': isMonthSelected(i), 'p-disabled': !isSelectable(1, i, currentYear) })}>
<span onClick={(event) => onMonthSelect(event, i)} key={`month${i + 1}`} className={classNames('p-monthpicker-month', { 'p-highlight': isMonthSelected(i), 'p-disabled': !isSelectable(0, i, currentYear) })}>
{m}
</span>
);
Expand Down

0 comments on commit 614628f

Please sign in to comment.