Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@bradhe/react-daterange-picker

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@bradhe/react-daterange-picker

A React based date range picker

  • 2.0.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created
Source

React Daterange Picker

A React based date range picker. Demo

Getting started

Installation

Add React Daterange Picker to your project by executing

npm install react-daterange-picker

or

yarn add react-daterange-picker

Usage

Here's an example of basic usage:

import React, {Component} from 'react'
import DateRangePicker from 'react-daterange-picker'
import 'react-daterange-picker/dist/css/react-calendar.css' // For some basic styling. (OPTIONAL)

class MyApp extends Component {
  state = {
    dates: null
  }

  onSelect = dates => this.setState({dates})

  render() {
    return (
      <div>
        <DateRangePicker
          onSelect={this.onSelect}
          value={this.state.dates}
        />
      </div>
    )
  }
}

Here is a working example: Edit 0xv5m04yql

Features

  • Select a date range in an intuitive way.
  • Define date ranges that are not available for selection.
  • Show any number of months at the same time.
  • Visually represent half day states.

Available props

propdescriptiondefaulttype
bemBlockString
bemNamespace'DateRangePicker'String
classNameString
dateStatesAn array of date ranges and their statesArray
defaultStateString
disableNavigationfalseBoolean
firstOfWeekThe first day of the week, as a number between 0-6, where 0 is Sunday0Integer
helpMessageString
initialDateDate
initialFromValuetrueBoolean
initialMonthOverrides values derived from initialDate/initialRangeInteger
initialRangeObject
initialYearOverrides values derived from initialDate/initialRangeInteger
localemoment().locale()String
maximumDateThe last date that is possible to choose. Every date after will be unselectablenullMoment or Date
minimumDateThe earliest date that is possible to choose. Every date before will be unselectablenullMoment or Date
numberOfCalendarsThe number of months showing next to each other1Integer
onHighlightDateTriggered when a date is highlighted (hovered)Function
onHighlightRangeTriggered when a range is highlighted (hovered)Function
onSelectTriggered when a date or range is selected. returns value({start, end}) => this.setState({start, end})
onSelectStartTriggered when the first date in a range is selectedFunction
paginationArrowComponentPaginationArrowComponent
selectedLabel'Your selected dates'String
selectionTypeString (single or range)
singleDateRangefalseBoolean
showLegendfalseBoolean
stateDefinitionsObject
valueContains the start and end value of the selected date range. Format: value={start: null, end: null} (moment range)nullMoment

React version

React 0.14, 15, and 16 are all supported in the latest version of react-daterange-picker.

If you wish to user an older version of React, please use react-daterange-picker v0.12.x or below.

Changelog

All change log information is available within the project's releases.

Contribute

Please feel to contribute to this project by making pull requests. You can see a list of tasks that can be worked on in the issues list.

Before a pull request can be merged, ensure that you have linted your files and all tests are passing -

npm run lint
npm run test

Publishing

If you have been added as a project contributor and wish to publish a new release -

  • Ensure that you have added yourself to the package.json contributors list
  • Bump the npm version as appropriate, following SemVer conventions
  • Update the Demo by running npm run deploy-example

Building example page

Once you have the repository cloned run the following commands to get started:

npm install
npm run develop

This will start a local server at http://localhost:9989 where you can see the example page. It will also watch for any files changes and rebuild. To update the compiled files in dist run npm run build-dist-js, and you can lint the code with npm run lint.

Keywords

FAQs

Package last updated on 22 Jul 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc