React Datepicker( can't get value of input)

Just use this:

handleChange = date => {
  const valueOfInput = date.format();
  ///...
};

Because this datepicker returns a moment.js object!

For more information, look into the moment.js docs here.


Try this

<DatePicker 
   onChange={(value, e) => this.handleChange(value, e)}
   selected={this.state.inputValue} otherProps={here} 
/>

// you can access the value field in handleChange by e.target.value

handleChange(value, e) {
    console.log(value); // this will be a moment date object
    console.log(e.target.value); // this will be a string value in datepicker input field
}