easy-react-datepicker
v1.0.2
Published
Date picker component for React
Downloads
1
Readme
Easy-React-Datepicker
Reusable React Datepicker component
Installing
Simply install using
npm install easy-react-datepicker --save
This will install the component in your project and add the reference to your package.json
Usage
//Import using
import DatePicker from 'easy-react-datepicker'
state = {
selectedDate:new Date(),
dateFormat: 'dddd'
}
//Use the Datepicker as follows
render() {
return (
<div>
<DatePicker selectedDate={new Date(this.state.selectedDate)} />
</div>
);
}
Example
Properties
| Property | Default | Description| | ------------- |:-------------:| -----:| | selectedDate | currentDate | Set the default date| | name | null | Use the name property if using the datepicker in a form, can be used to retrive the value of datepicker | | dateFormat | DD/MM/YYYY | Set the format of the date in the datepicker input box, refer MomentJS Date Formating|
Handlers
| Event | Description | Param| | ------------- |:-------------:| -----:| | dateSelected | Called when a new date is selected | Returns the date selected of type Date |
Note
- The default date need to be passed in the Javascript Date format