Skip to content

briantingtc/react-date-range

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

93 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

react-date-range

A React component for choosing dates and date ranges. Uses Moment.js for date operations.

Live Demo : http://adphorus.github.io/react-date-range

Getting Started

Installation

$ npm install --save react-date-range

Usage

import React, { Component } from 'react';
import { DateRange } from 'react-date-range';

class MyComponent extends Component {
	handleSelect(range){
		console.log(range);
		// An object with two keys,
		// 'startDate' and 'endDate' which are Momentjs objects.
	}

	render(){
		return (
			<div>
				<DateRange
					onInit={this.handleSelect}
					onChange={this.handleSelect}
				/>
			</div>
		)
	}
}
Available Options (props)
  • date: (String, Moment.js object, Function) - default: today
  • format: (String) - default: DD/MM/YYY
  • firstDayOfWeek (Number) - default: moment.localeData().firstDayOfWeek()
  • theme: (Object) see Demo's source
  • onInit: (Function) default: none
  • onChange: (Function) default: none
  • linkedCalendars: (Boolean) default: false
  • calendars: (Number) default: 2
  • ranges: (Object) default: none
  • selectYear (Boolean) default: false
    Activates select year dropdown.
  • yearRange (Object) default: {start: 10, end: 10} Specifies the year range of the options in selectYear dropdown.
  • pickSingleDate (Boolean)
    Calendar only picks a single date.
  • showIndex (Number)
    Specifies the calendar where the date will be shown if there are multiple calendars.

About

A React component for choosing dates and date ranges.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 98.5%
  • CSS 1.2%
  • HTML 0.3%