Skip to content

Commit

Permalink
[Datepicker] Add a check to fetch current system date
Browse files Browse the repository at this point in the history
Added a check which helps pick the current system date when the date-picker dialog
 is opened.

Resolves #3545
  • Loading branch information
tintin1343 committed Mar 10, 2016
1 parent 04e81b1 commit 6d8a952
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions src/date-picker/date-picker.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -212,9 +212,20 @@ const DatePicker = React.createClass({
* Open the date-picker dialog programmatically from a parent.
*/
openDialog() {
this.setState({
dialogDate: this.getDate(),
}, this.refs.dialogWindow.show);
/**
* if the date is not selected then set it to new date
* (get the current system date while doing so)
* else set it to the currently selected date
*/
if (this.state.date !== undefined) {
this.setState({
dialogDate: this.getDate(),
}, this.refs.dialogWindow.show);
} else {
this.setState({
dialogDate: new Date(),
}, this.refs.dialogWindow.show);
}
},

/**
Expand Down

0 comments on commit 6d8a952

Please sign in to comment.