File tree Expand file tree Collapse file tree 1 file changed +4
-0
lines changed
Expand file tree Collapse file tree 1 file changed +4
-0
lines changed Original file line number Diff line number Diff line change @@ -659,6 +659,7 @@ export default class DatePicker extends Component<
659659 event ?: React . MouseEvent < HTMLElement > | React . KeyboardEvent < HTMLElement > ,
660660 monthSelectedIn ?: number ,
661661 ) => {
662+ if ( this . props . readOnly ) return ;
662663 if ( this . props . shouldCloseOnSelect && ! this . props . showTimeSelect ) {
663664 // Preventing onFocus event to fix issue
664665 // https://github.com/Hacker0x01/react-datepicker/issues/628
@@ -829,6 +830,7 @@ export default class DatePicker extends Component<
829830
830831 // When checking preSelection via min/maxDate, times need to be manipulated via getStartOfDay/getEndOfDay
831832 setPreSelection = ( date ?: Date | null ) : void => {
833+ if ( this . props . readOnly ) return ;
832834 const hasMinDate = isDate ( this . props . minDate ) ;
833835 const hasMaxDate = isDate ( this . props . maxDate ) ;
834836 let isValidDateSelection = true ;
@@ -1388,9 +1390,11 @@ export default class DatePicker extends Component<
13881390 clearButtonClassName = "" ,
13891391 ariaLabelClose = "Close" ,
13901392 selectedDates,
1393+ readOnly,
13911394 } = this . props ;
13921395 if (
13931396 isClearable &&
1397+ ! readOnly &&
13941398 ( selected != null ||
13951399 startDate != null ||
13961400 endDate != null ||
You can’t perform that action at this time.
0 commit comments