Skip to content

Commit

Permalink
fix(DatePicker): avoid aggressive range input clearing (#8893)
Browse files Browse the repository at this point in the history
* refactor(DatePicker): optionally chain `this.cal` reference check

* fix(DatePicker): avoid aggressive range input clearing

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
  • Loading branch information
emyarod and kodiakhq[bot] authored Jun 16, 2021
1 parent 5f9ae2a commit 0107fb1
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions packages/react/src/components/DatePicker/DatePicker.js
Original file line number Diff line number Diff line change
Expand Up @@ -445,12 +445,8 @@ export default class DatePicker extends Component {
}
}

onChange = (e) => {
if (
e.target.value === '' &&
this.cal &&
this.cal.selectedDates.length > 0
) {
onChange = () => {
if (this.inputField.value === '' && this.cal?.selectedDates.length) {
this.cal.clear();
}
};
Expand Down

0 comments on commit 0107fb1

Please sign in to comment.