react-component-date-picker

0.9.10 • Public • Published

React Component DatePicker

npm version

Usage

npm install react-component-date-picker

Then you can import or require with your preferred module builder.

import { DatePicker, DateUtilities } from 'react-component-date-picker'

Or

var reactDatePicker = require('react-component-date-picker);

var DatePicker = reactDatePicker.DatePicker;

An example in es2015 and jsx:

import React, { Component } from 'react';
import ReactDOM from 'react-dom';
import { connect } from 'react-redux';

import { DatePicker, DateUtilities } from '../datepicker/index';

function mapStateToProps(state) {
  return {
    date: state.date
  };
}

class App extends Component {

  render() {
    const { date, onChange } = this.props;
    return (
      <div>
        <input type={"text"} className={"date-picker-trigger"} value={DateUtilities.toYearMonthDateString(date)} readOnly></input>
        <DatePicker visible={true} displayDate={new Date()} selectedDate={date} onChange={onChange}/>
      </div>
    );
  }
}

export default connect(mapStateToProps)(App);

Dependents (0)

Package Sidebar

Install

npm i react-component-date-picker

Weekly Downloads

3

Version

0.9.10

License

MIT

Last publish

Collaborators

  • paulrenenichols