File tree Expand file tree Collapse file tree 2 files changed +14
-7
lines changed
src/PickerPanel/YearPanel Expand file tree Collapse file tree 2 files changed +14
-7
lines changed Original file line number Diff line number Diff line change @@ -66,13 +66,9 @@ export default function YearPanel<DateType extends object = any>(
66
66
const startDate = generateConfig . setDate ( startMonth , 1 ) ;
67
67
68
68
// End
69
- const endMonth = generateConfig . setMonth (
70
- currentDate ,
71
- generateConfig . getMonth ( currentDate ) + 1 ,
72
- ) ;
73
- const enDate = generateConfig . addDate ( endMonth , - 1 ) ;
74
-
75
- return disabledDate ( startDate , disabledInfo ) && disabledDate ( enDate , disabledInfo ) ;
69
+ const endMonth = generateConfig . addYear ( startDate , 1 ) ;
70
+ const endDate = generateConfig . addDate ( endMonth , - 1 ) ;
71
+ return disabledDate ( startDate , disabledInfo ) && disabledDate ( endDate , disabledInfo ) ;
76
72
}
77
73
: null ;
78
74
Original file line number Diff line number Diff line change @@ -715,4 +715,15 @@ describe('Picker.Panel', () => {
715
715
expect ( container . querySelector ( '.rc-picker-header-view' ) . textContent ) . toEqual ( '01:02:03 AM' ) ;
716
716
} ) ;
717
717
718
+ it ( 'year panel disabled check' , ( ) => {
719
+ const { container } = render (
720
+ < DayPickerPanel
721
+ picker = "year"
722
+ disabledDate = { ( date ) => date . isBefore ( getDay ( '1990-12-25' ) ) }
723
+ defaultValue = { getDay ( '1990-01-01' ) }
724
+ /> ,
725
+ ) ;
726
+
727
+ expect ( container . querySelector ( '.rc-picker-cell-selected' ) . textContent ) . toEqual ( '1990' ) ;
728
+ } ) ;
718
729
} ) ;
You can’t perform that action at this time.
0 commit comments