Socket
Socket
Sign inDemoInstall

react-bootstrap-daterangepicker

Package Overview
Dependencies
0
Maintainers
1
Versions
57
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    react-bootstrap-daterangepicker

A date/time picker for react (using bootstrap). This is a react port of: https://github.com/dangrossman/bootstrap-daterangepicker


Version published
Maintainers
1
Install size
53.7 kB
Created

Changelog

Source

7.0.0-beta.0 (2020-08-11)

Full Changelog

Closed issues:

  • Specifying the language #218
  • singleDatePicker - Change date from input. #217
  • singleDatePicker shows range of dates when date is changed dynamically #211
  • end date active error #210
  • accessibility support or keyboard navigation is not supported #207
  • how can i put checkbox inside calender #205
  • Calendar jumps to start date after selecting end date in range selection #202
  • this.props undefined #201
  • V4 is unusable with inputs #200
  • showDropdown/timePicker failing #199
  • How to set date range only for startDate #198
  • Customise Range selection #197
  • Calendar opens and closes on each input event #195
  • startDate should be always set before endDate #194
  • The NPM package does not match the Github code #193
  • How can I customise the calendar? #192
  • Property applyButtonClasses, cancelButtonClasses not apply #191
  • autoUpdateInput - Unknown props autoUpdateInput, singleDatePicker, startDate on <div> tag. Remove these props from the element. #190
  • Uncaught ReferenceError: DateRangePicker is not defined #189
  • minDate is not working #187
  • Can you please update react-bootstrap-daterangepicker to react 16 , we are in dire need of it, thanks a mil #186
  • How do I manually enter a date using the daterangepicker@3.0.3? #185
  • endDate dose not work. #184
  • this.$picker.daterangepicker is not a function error while running Jest test cases #183
  • Problem with using in window.open #182
  • TypeError: Cannot read property 'any' of undefined #181
  • Selected range always showing 'Custom' when 'timePickerSeconds' is true #180
  • Is there any way to provide an input box instead of a button? #179
  • How to disable future TIME in TimePicker? #178
  • Please add minYear and maxYear to the properties #177
  • Update startDate endDate #176
  • How to get input boxes at the top of the calendar #175
  • Uncaught TypeError: moment is not a function #174
  • calenders showing up stacked vertically instead of horizontally #173
  • Issues using react-bootstrap-daterangepicker with redux-form #172
  • Can't resolve 'bootstrap-daterangepicker' #171
  • Style should not be set by default. #170
  • Daterangepicker appending to body. Not able to append it to div element? #168
  • Issue with React v16.2.0 #166
  • Glyphicon not working correctly - Edit (Glyphicon is no longer supported in bs4) #161
  • Month picker #155
  • Enabling preact breaks the daterange picker. #152
  • How to make DateRangePicker as an inline component ( show always and not on input focus) ? Also, How to display only one calendar for start and end date ? #151
  • Element Type Is Invalid #148
  • Dropdown Menu Broken in Dialog #147
  • 3.4.0 broke usage with multiple children nodes #146
  • Add className to datepicker? #141
  • breaks for me in v3.4.0 #140
  • Warning: Stateless function components cannot be given refs (See ref "picker" in Input created by null). Attempts to access this ref will fail. #138
  • Getting Expected onMountComponent() to fire for the child before its parent includes it in onSetChildren(). #137
  • autoApply property doesn't work #131
  • opens "left" doesn't work for me #127
  • when we install this package, we get all the locale files , I just need locale file for english, how do we fix it ? #125
  • Can't set singleDatePicker dynamically #123
  • Mobile Support props #122
  • chosenLabel property is not reset on new apply event and stores value of previous selection #120
  • How to set "xs" class for button? #119
  • How to make Custom Range preselected and calendars always shown? #118
  • Uncaught (in promise) TypeError: $this.$picker.daterangepicker is not a function #117
  • 34Uncaught (in promise) TypeError: moment is not a function(…) #116
  • Dublicated startDate #114
  • onApply is not fired #112
  • autoApply does not hide Apply and Cancel buttons. #111
  • Browser build #95
  • autoApply not working #91
  • Bootstrap form-control classes for timePicker selects #88
  • Can't modify format of custum range endDate and startDate #83
  • setOptionsFromProps creates wrong param order #82
  • Deprecation warning: moment construction falls back to js Date #77
  • Uncaught Invariant Violation: addComponentAsRefTo(...): #69
  • error when pass props parentEl to string "#some-div-id" #67
  • Error when you pass null-s to startDate and EndDate #65
  • Add global.jQuery = $ to index.js #60
  • Missing documentation for "timeZone" parameter #59
  • Global MomentJS locale setting is ignored #57
  • partial param in locale case error #53
  • Is it possible to support disabled={true} #52
  • Error with React 0.14 + Changing Properties #51
  • If the element under the <DateRangePicker> has float attribute, the container top position is not right #50
  • How Calendar is Displayed #48
  • Uncaught TypeError: this.parentEl.is is not a function #46
  • Can not be used in the case of jquery 2.1.4 #45
  • Option props not being set properly on render #44
  • Cannot set property 'daterangepicker' of undefined #43
  • Uncaught TypeError: $this.$picker.daterangepicker is not a function #42
  • Typing dates in custom ranges are too sensitive #30
  • Version without jQuery #29
  • How to close a modal by a funciton #17
  • Server rendering: TypeError: Cannot read property 'document' of undefined #14
  • Question: Use as content of modal body? #6

Readme

Source

react-bootstrap-daterangepicker

NPM version Build Status Code Climate Coverage Status Dependency Status devDependency Status

NPM

Description

A date/time picker for react (using bootstrap). This is a react wrapper around an existing jQuery/bootstrap library (it is not a pure react port):

bootstrap-daterangepicker

Getting Started

  1. Install the needed peer dependencies: npm install --save bootstrap-daterangepicker react jquery moment

  2. Install the module with: npm install --save react-bootstrap-daterangepicker

  3. Include the bootstrap@4 css and fonts in your project. (aka import 'bootstrap/dist/css/bootstrap.css';)

  4. Include the bootstrap-daterangepicker css in your project. (aka import 'bootstrap-daterangepicker/daterangepicker.css';)

  5. This is a commonjs library. You will need a tool like browserify/webpack/etc to build your code.

import React, { Component } from 'react';
import DateRangePicker from 'react-bootstrap-daterangepicker';
// you will need the css that comes with bootstrap@3. if you are using
// a tool like webpack, you can do the following:
import 'bootstrap/dist/css/bootstrap.css';
// you will also need the css that comes with bootstrap-daterangepicker
import 'bootstrap-daterangepicker/daterangepicker.css';

class MyComponent {
  render() {
    return (
      <DateRangePicker
        initialSettings={{ startDate: '1/1/2014', endDate: '3/1/2014' }}
      >
        <button>Click Me To Open Picker!</button>
      </DateRangePicker>
    );
  }
}

Documentation

For in depth documentation, see the original bootstrap-daterangepicker project page.

You can pass all the settings from the original plugin to the initialSettings prop:

  • <input>, alwaysShowCalendars, applyButtonClasses, applyClass, autoApply, autoUpdateInput, buttonClasses, cancelButtonClasses, cancelClass, dateLimit, drops, endDate, isCustomDate, isInvalidDate, linkedCalendars, locale, maxDate, maxSpan, maxYear, minDate, minYear, moment, opens, parentEl, ranges, showCustomRangeLabel, showDropdowns, showISOWeekNumbers, showWeekNumbers, singleDatePicker, startDate, template, timePicker, timePicker24Hour, timePickerIncrement, timePickerSeconds

You can listen to the following 8 events:

  • onShow: callback(event, picker) thrown when the widget is shown
  • onHide: callback(event, picker) thrown when the widget is hidden
  • onShowCalendar: callback(event, picker) thrown when the calendar is shown
  • onHideCalendar: callback(event, picker) thrown when the calendar is hidden
  • onApply: callback(event, picker) thrown when the apply button is clicked
  • onCancel: callback(event, picker) thrown when the cancel button is clicked
  • onEvent: callback(event, picker) thrown when any of the 6 events above are triggered
  • onCallback: callback(start, end, label) thrown when the start/end dates change

You MUST pass a single child element to the <DateRangePicker /> component- and it MUST be a DOM element. Passing custom react components is not currently supported b/c this lib needs a single dom node to initialize.

NOTE: This component should be used as an Uncontrolled Component. If you try to control the value of your child <input />, the you will probably encounter issues.

There are 2 methods from the upstream lib that can be called: setStartDate and setEndDate, but you need to use refs when doing so. Please view the storybook for an example of this.

Examples

For more usage examples, please view the storybook:
https://projects.skratchdot.com/react-bootstrap-daterangepicker/

Simple button example
<DateRangePicker>
  <button type="button" className="btn btn-primary">
    click to open
  </button>
</DateRangePicker>
Simple input example
<DateRangePicker>
  <input type="text" className="form-control" />
</DateRangePicker>
Initialize with a startDate and endDate
<DateRangePicker
  initialSettings={{ startDate: '01/01/2020', endDate: '01/15/2020' }}
>
  <input type="text" className="form-control" />
</DateRangePicker>
Example event handler:
class SomeReactComponent extends React.Component {
  handleEvent(event, picker) {
    console.log(picker.startDate);
  }
  handleCallback(start, end, label) {
    console.log(start, end, label);
  }
  render() {
    return (
      <DateRangePicker onEvent={this.handleEvent} onCallback={this.handleCallback}>
        <input />
      </DateRangePicker>;
  }
}

Release Notes

Release notes can be found in the Changelog.

Other React Date Pickers

NOTE: Please submit a PR if there are other date pickers you can recommend

License

Copyright (c) 2014 skratchdot
Uses the original bootstrap-daterangepicker license.

Keywords

FAQs

Last updated on 11 Aug 2020

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc