Skip to content

Commit

Permalink
When time picker is displayed close picker when time is selected
Browse files Browse the repository at this point in the history
Don't close picker when only date is selected
  • Loading branch information
CI Builds committed Dec 11, 2017
1 parent cf2ca74 commit d1fe6e7
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ export default class DatePicker extends React.Component {

setFocus = () => {
if (this.input.focus) {
this.input.focus();
this.input.focus()
}
}

Expand Down Expand Up @@ -264,7 +264,7 @@ export default class DatePicker extends React.Component {
}
)
this.setSelected(date, event)
if (!this.props.shouldCloseOnSelect) {
if (!this.props.shouldCloseOnSelect || this.props.showTimeSelect) {
this.setPreSelection(date)
} else if (!this.props.inline) {
this.setOpen(false)
Expand Down Expand Up @@ -323,6 +323,7 @@ export default class DatePicker extends React.Component {
})

this.props.onChange(changedDate)
this.setOpen(false)
}

onInputClick = () => {
Expand Down

0 comments on commit d1fe6e7

Please sign in to comment.