reactjs-datepicker-calendar
v1.0.1
Published
```js // In your React component: updateState (dates, count) { if( dates.length > 1 ) this.setState({ firstDate: dates[0], lastDate: dates[1], countDays: count });
Downloads
4
Readme
Datepicker React Calender
Example
// In your React component:
updateState (dates, count) {
if( dates.length > 1 )
this.setState({
firstDate: dates[0],
lastDate: dates[1],
countDays: count
});
else
this.setState({
firstDate: dates[0],
lastDate: dates[0],
countDays: count
});
};
state = {
firstDate: {
day: 29,
month: 5,
year: 2018
},
lastDate: {
day: 4,
month: 6,
year: 2018
},
...
};
render()
{
return(
<Datepicker
updatedDays={this.updateState}
firstDate={this.state.firstDate}
lastDate={this.state.lastDate} />
)
}
How to install
npm i reactjs-datepicker-calendar
How to use
// using import:
import React from 'react';
import Datepicker from 'reactjs-datepicker-calendar';
class MyComponentWithDatepicker extends React.Component {
render() {
return <Datepicker updatedDays={this.updateState}
firstDate={this.state.firstDate}
lastDate={this.state.lastDate} />;
}
}