npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

react-bootstrap-datetimerangepicker_r16

v2.0.4

Published

React date & time range picker component base on bootstrap-daterangepicker. This date range picker component for Bootstrap creates a dropdown menu from which a user can select a range of dates. Features include limiting the selectable date range, localiza

Downloads

4

Readme

React Date&Time Range Picker for Bootstrap

NPM version Build Status

Dependency Status devDependency Status peerDependency Status

Improvely.com

This date range picker component for Bootstrap creates a dropdown menu from which a user can select a range of dates.

Base on bootstrap-daterangepicker

Online demo: http://luqin.github.io/react-bootstrap-datetimerangepicker

Features

  • limiting the selectable date range
  • localizable strings and date formats
  • a single date picker mode
  • optional time picker (for e.g. making appointments or reservations)
  • styles that match the default Bootstrap 3 theme

Upgrade guide

<2.0 to 2.x

Using official bootstrap-daterangepicker

# <2.0
npm install react-bootstrap-datetimerangepicker onefe-bootstrap-daterangepicker --save

# 2.x
npm install react-bootstrap-datetimerangepicker bootstrap-daterangepicker --save
// <2.0
import 'bootstrap/dist/css/bootstrap.css';
import 'onefe-bootstrap-daterangepicker/daterangepicker.css';

// 2.x
import 'bootstrap/dist/css/bootstrap.css';
import 'bootstrap-daterangepicker/daterangepicker.css';

Installation

npm install react-bootstrap-datetimerangepicker bootstrap-daterangepicker --save

Usage

Date Range Picker relies on Bootstrap, jQuery and Moment.js. Include the required stylesheet in your page:

import 'bootstrap/dist/css/bootstrap.css';
import 'bootstrap-daterangepicker/daterangepicker.css';
import DatetimeRangePicker from 'react-bootstrap-datetimerangepicker';

<DatetimeRangePicker
    startDate={this.state.startDate}
    endDate={this.state.endDate}
    onApply={this.handleApply}
>
    <input type="text" value={label}/>
</DatetimeRangePicker>

<DatetimeRangePicker
    timePicker
    timePicker24Hour
    showDropdowns
    timePickerSeconds
    locale={locale}
    startDate={this.state.startDate}
    endDate={this.state.endDate}
    onApply={this.handleApply}
>
    <Button>
        <i className="fa fa-calendar"/> &nbsp;
        <span>{label}</span>
        <i className="fa fa-angle-down"/>
    </Button>
</DatetimeRangePicker>

More examples: Online demo, Source

Documentation

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

Options

  • startDate: (Date object, moment object or string) The start of the initially selected date range
  • endDate: (Date object, moment object or string) The end of the initially selected date range
  • minDate: (Date object, moment object or string) The earliest date a user may select
  • maxDate: (Date object, moment object or string) The latest date a user may select
  • dateLimit: (object) The maximum span between the selected start and end dates. Can have any property you can add to a moment object (i.e. days, months)
  • showDropdowns: (boolean) Show year and month select boxes above calendars to jump to a specific month and year
  • showWeekNumbers: (boolean) Show week numbers at the start of each week on the calendars
  • timePicker: (boolean) Allow selection of dates with times, not just dates
  • timePickerIncrement: (number) Increment of the minutes selection list for times (i.e. 30 to allow only selection of times ending in 0 or 30)
  • timePicker24Hour: (boolean) Use 24-hour instead of 12-hour times, removing the AM/PM selection
  • timePickerSeconds: (boolean) Show seconds in the timePicker
  • ranges: (object) Set predefined date ranges the user can select from. Each key is the label for the range, and its value an array with two dates representing the bounds of the range
  • opens: (string: 'left'/'right'/'center') Whether the picker appears aligned to the left, to the right, or centered under the HTML element it's attached to
  • drops: (string: 'down' or 'up') Whether the picker appears below (default) or above the HTML element it's attached to
  • buttonClasses: (array) CSS class names that will be added to all buttons in the picker
  • applyClass: (string) CSS class string that will be added to the apply button
  • cancelClass: (string) CSS class string that will be added to the cancel button
  • locale: (object) Allows you to provide localized strings for buttons and labels, customize the date display format, and change the first day of week for the calendars
  • singleDatePicker: (boolean) Show only a single calendar to choose one date, instead of a range picker with two calendars; the start and end dates provided to your callback will be the same single date chosen
  • autoApply: (boolean) Hide the apply and cancel buttons, and automatically apply a new date range as soon as two dates or a predefined range is selected
  • linkedCalendars: (boolean) When enabled, the two calendars displayed will always be for two sequential months (i.e. January and February), and both will be advanced when clicking the left or right arrows above the calendars. When disabled, the two calendars can be individually advanced and display any month/year.
  • parentEl: (string) jQuery selector of the parent element that the date range picker will be added to, if not provided this will be 'body'
  • isInvalidDate: (function) A function that is passed each date in the two calendars before they are displayed, and may return true or false to indicate whether that date should be available for selection or not.
  • autoUpdateInput: (boolean) Indicates whether the date range picker should automatically update the value of an element it's attached to at initialization and when the selected dates change.

Events

  • onShow: Triggered when the picker is shown
  • onHide: Triggered when the picker is hidden
  • onHideCalendar: Triggered when the calendar(s) are shown
  • onApply: Triggered when the calendar(s) are hidden
  • onCancel: Triggered when the apply button is clicked, or when a predefined range is clicked
  • onEvent: Triggered when the cancel button is clicked

All of the events above should take a handler that is passed 2 arguments: event and picker

Example event handler:

var SomeReactComponent = React.createClass({
    handleEvent: function (event, picker) {
        console.log(picker.startDate);
    },
    render: function () {
        return (
            <DatetimeRangePicker onEvent={this.handleEvent} />
        );
    }
});

Browser support

  • Google Chrome
  • Firefox (2+)
  • IE (9+)
  • Opera (11.6+)
  • Safari (6+)

Local Setup

  • Install the dependencies with npm install
  • Run the docs site in development mode with npm start. This will watch for file changes as you work. And auto refresh the page to see the updates.