Skip to content
This repository was archived by the owner on May 19, 2025. It is now read-only.

Commit 1c5a973

Browse files
committed
fix year selection range
1 parent e399fcb commit 1c5a973

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/Calendar.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ class Calendar extends PureComponent {
7474
const { showMonthArrow, locale, minDate, maxDate } = this.props;
7575
const upLimit = maxDate ? maxDate.getFullYear() : addYears(new Date(), 20).getFullYear();
7676
const downLimit = minDate ? minDate.getFullYear() : addYears(new Date(), -100).getFullYear();
77+
console.log(downLimit, upLimit);
7778
const styles = this.styles;
7879
return (
7980
<div className={styles.monthAndYearWrapper}>
@@ -102,7 +103,7 @@ class Calendar extends PureComponent {
102103
<select
103104
value={focusedDate.getFullYear()}
104105
onChange={e => this.changeShownDate('setYear', e.target.value)}>
105-
{new Array(upLimit - downLimit).fill(upLimit).map((val, i) => {
106+
{new Array(upLimit - downLimit + 1).fill(upLimit).map((val, i) => {
106107
const year = val - i;
107108
return (
108109
<option key={year} value={year}>

0 commit comments

Comments
 (0)