1.0.1 • Published 6 years ago

reactjs-datepicker-calendar v1.0.1

Weekly downloads
4
License
ISC
Repository
-
Last release
6 years ago

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} />;
  }
}

Demo

Demo

Example

example