Rudeg / react-input-calendar

http://rudeg.github.io/react-input-calendar/
MIT License
139 stars 94 forks source link

How to get current date onChange ? #108

Closed Triyugi closed 7 years ago

Triyugi commented 7 years ago

I am using <Calendar format='dddd DD MMM' date={this.state.value0} inputName="date" computableFormat='MM-DD-YYYY' onChange={this.handleChange} />`

How can I get value of current input value in handleChange() ?

dbrack commented 7 years ago

You simply have to define the onChange function in your component accordingly.

The handleChange function should be something as follows

handleChange = (d) => {
  console.log(d); // <-- d will hold the date value in the format that was defined in computableFormat
};
Rudeg commented 7 years ago

Thanks @dbrack