Skip to content

Commit

Permalink
Fix #1661: Calendar do not navigate past min and max
Browse files Browse the repository at this point in the history
  • Loading branch information
melloware committed May 9, 2022
1 parent 70c2b2f commit 4a983cf
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 1 deletion.
6 changes: 6 additions & 0 deletions api-generator/components/calendar.js
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,12 @@ const CalendarProps = [
default: 'null',
description: 'Maximum number of selectable dates in multiple mode.'
},
{
name: 'showOutliers',
type: 'boolean',
default: 'true',
description: 'Whether to allow navigation past min/max dates.'
},
{
name: 'showOtherMonths',
type: 'boolean',
Expand Down
6 changes: 6 additions & 0 deletions components/doc/calendar/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -1107,6 +1107,12 @@ const monthNavigatorTemplate = (options) => {
<td>null</td>
<td>Maximum number of selectable dates in multiple mode.</td>
</tr>
<tr>
<td>showOutliers</td>
<td>boolean</td>
<td>true</td>
<td>Whether to allow navigation past min/max dates.</td>
</tr>
<tr>
<td>showOtherMonths</td>
<td>boolean</td>
Expand Down
1 change: 1 addition & 0 deletions components/lib/calendar/Calendar.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ export interface CalendarProps {
minDate?: Date;
maxDate?: Date;
maxDateCount?: number;
showOutliers?: boolean;
showOtherMonths?: boolean;
selectOtherMonths?: boolean;
showButtonBar?: boolean;
Expand Down
3 changes: 2 additions & 1 deletion components/lib/calendar/Calendar.js
Original file line number Diff line number Diff line change
Expand Up @@ -948,7 +948,7 @@ export const Calendar = React.memo(React.forwardRef((props, ref) => {
}

const setNavigationState = (newViewDate) => {
if (props.view !== 'date' || !overlayRef.current) {
if (!props.showOutliers || props.view !== 'date' || !overlayRef.current) {
return;
}

Expand Down Expand Up @@ -3160,6 +3160,7 @@ Calendar.defaultProps = {
minDate: null,
maxDate: null,
maxDateCount: null,
showOutliers: true,
showOtherMonths: true,
selectOtherMonths: false,
showButtonBar: false,
Expand Down

0 comments on commit 4a983cf

Please sign in to comment.