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-datetime-range-picker

v3.0.0

Published

Reusable date time range picker

Downloads

3,634

Readme

react-datetime-range-picker

This is a datetime range picker based off of react-datetime. It is highly customizable and isn't dependent on jQuery (but it does require Moment).

Installation

> npm install --save react-datetime react-datetime-range-picker

Usage

import DatetimeRangePicker from 'react-datetime-range-picker';

...

  render() {
    return (
      <DatetimeRangePicker
        onChange={this.handler} />
    );
  }

...

Options

Almost all the props available for react-datetime are available for use here too.

| Name | Type | Default | Description | |------|------|---------|-------------| | startDate | Date | new Date() | This sets a value for the start date | | endDate | Date | new Date() | This sets a value for the end date | | dateFormat | Boolean or String | true | Defines the format for the date. It accepts any Moment date format (not in localized format). If true the date will be displayed using the defaults for the current locale. If false the datepicker is disabled and the component can be used as timepicker. | | timeFormat | Boolean or String | true | Defines the format for the time. It accepts any Moment time format (not in localized format). If true the time will be displayed using the defaults for the current locale. If false the timepicker is disabled and the component can be used as datepicker. | | utc | boolean | false | When true, start and end time values will be interpreted as UTC. Otherwise they will default to the user's local timezone. | | locale | String | null | Manually set the locale | | input | Boolean | false | This defines whether or not to allow user to manually edit date via input field. | | inline | Boolean | false | If set to true will render start date and end date with calender without input fields | | onBlur | Function | () => {} | This callback is triggered when user clicks outside the datetime range picker. The callback receives an object with the selected start and date date as only parameter. | | onFocus | Function | () => {} | This callback is triggered when user clicks anywhere inside the outermost element of the picker | | onChange | Function | () => {} | This callback is triggered everytime a user selects a start date or an end date from the picker | | viewMode | String | days | This defines the default view to display when the pickers are shown. ('years', 'months', 'days', 'time'). | | closeOnTab | Boolean | true | When true and the input is focused, pressing the tab key will close the datepicker. | | className | String | '' | CSS class(es) for the outermost markup element. | | inputProps | Object | undefined | Defines additional attributes for the input element of the component. For example: placeholder, disabled, required, name and className (className sets the class attribute for the input element). This applies to both the start and end datetime inputs | | closeOnSelect | Boolean | false | When true, once the day has been selected, the datepicker will be automatically closed. This is useful when using this as a date range picker instead of datetime range picker | | isValidEndDate | Function | () => true | Define the dates that can be selected in the end date picker. The function receives (currentDate, selectedDate) and shall return a true or false whether the currentDate is valid or not. | | isValidStartDate | Function | () => true | Define the dates that can be selected in the start date picker. The function receives (currentDate, selectedDate) and shall return a true or false whether the currentDate is valid or not. | | onEndDateBlur | Function | () => {} | Callback is triggered when user clicks outside the end date input. The callback receives the selected moment object as only parameter, if the date in the input is valid. If the date in the input is not valid, the callback returned. | | onEndDateFocus | Function | () => {} | Callback trigger for when the user opens the end date datepicker. | | onEndDateChange | Function | () => {} | This callback is triggered everytime the end date changes. It receives the selected date as the only parameter. | | onStartDateBlur | Function | () => {} | This callback is trigger when user clicks outside of the start date input. The callback receives the selected start date as the a parameter | | onStartDateFocus | Function | () => {} | Callback trigger for when the user opens the end date datepicker. | | onStartDateChange | Function | () => {} | Callback trigger for when start date changes. This callback receives selected moment object as a parameter. | | pickerClassName | String | '' | CSS class to attach to outer div that wraps the individual pickers. This class is applied to both the start and end pickers. This is particular useful if you want to add col-* | | startTimeConstraints | Object | null | Add some constraints to the start timepicker. It accepts an object with the format { hours: { min: 9, max: 15, step: 2 }}, this example means the hours can't be lower than 9 and higher than 15, and it will change adding or subtracting 2 hours everytime the buttons are clicked. The constraints can be added to the hours, minutes, seconds and milliseconds. | | endTimeConstraints | Object | null | Add some constraints to the end timepicker. It accepts an object with the format { hours: { min: 9, max: 15, step: 2 }}, this example means the hours can't be lower than 9 and higher than 15, and it will change adding or subtracting 2 hours everytime the buttons are clicked. The constraints can be added to the hours, minutes, seconds and milliseconds. |

NB: You can read more about customization of the individual datepickers here

Maintainers

Samuel Amoah (snamoah)