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>(
6666 const startDate = generateConfig . setDate ( startMonth , 1 ) ;
6767
6868 // 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 ) ;
7672 }
7773 : null ;
7874
Original file line number Diff line number Diff line change @@ -715,4 +715,15 @@ describe('Picker.Panel', () => {
715715 expect ( container . querySelector ( '.rc-picker-header-view' ) . textContent ) . toEqual ( '01:02:03 AM' ) ;
716716 } ) ;
717717
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+ } ) ;
718729} ) ;
You can’t perform that action at this time.
0 commit comments