Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -659,6 +659,7 @@ export default class DatePicker extends Component<
event?: React.MouseEvent<HTMLElement> | React.KeyboardEvent<HTMLElement>,
monthSelectedIn?: number,
) => {
if (this.props.readOnly) return;
if (this.props.shouldCloseOnSelect && !this.props.showTimeSelect) {
// Preventing onFocus event to fix issue
// https://github.com/Hacker0x01/react-datepicker/issues/628
Expand Down Expand Up @@ -829,6 +830,7 @@ export default class DatePicker extends Component<

// When checking preSelection via min/maxDate, times need to be manipulated via getStartOfDay/getEndOfDay
setPreSelection = (date?: Date | null): void => {
if (this.props.readOnly) return;
const hasMinDate = isDate(this.props.minDate);
const hasMaxDate = isDate(this.props.maxDate);
let isValidDateSelection = true;
Expand Down Expand Up @@ -1388,9 +1390,11 @@ export default class DatePicker extends Component<
clearButtonClassName = "",
ariaLabelClose = "Close",
selectedDates,
readOnly,
} = this.props;
if (
isClearable &&
!readOnly &&
(selected != null ||
startDate != null ||
endDate != null ||
Expand Down
Loading