0.0.2 • Published 6 years ago

react-inline-date v0.0.2

Weekly downloads
3
License
MIT
Repository
github
Last release
6 years ago

react-inline-date

React Date Input Component.

Demo

https://cheekujha.github.io/react-inline-date/

Install

You need to have react and react-dom as dependencies in your project.

  1. With npm installed, run
$ npm install react-inline-date --save
  1. At this point you can import react-inline-date in your application as follows:
import DateInput from 'react-inline-date';

Usage

  1. Wrap header columns (th / td) with TableFilter as shown below.
import React from 'react';
import DateInput,{TYPE_DATE} from 'react-inline-date';

class Example extends React.Component {
  constructor (props) {
    super(props)
    this.state = {
      startDate: undefined
    };
    this.handleChange = this.handleChange.bind(this);
  }

  handleChange(timestamp) {
    this.setState({
      startDate: timestamp
    });
  }

  render() {
    return <DateInput
        type={TYPE_DATE}
        value={this.state.startDate}
        onCommit={this.handleChange}
    />;
  }
}

API

Properties

DateInput

NameTypeDefaultRequiredDescription
typeString'date'trueCan be one of 'date', 'datetime', 'time'
valueTimestampundefinedfalseInitial Value
onCommitfunction(timestamp, event)trueFunction called when a date is selected
maxOffsetTimestampfalseDate Upper limit
minOffsetTimestampfalseDate Lower Limit

License

MIT