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

@opuscapita/react-date-range

v2.4.3

Published

OpusCapita react component template

Downloads

34

Readme

react-date-range

Description

Date range component is a component that can be useful for selecting date ranges.

Installation

npm install @opuscapita/react-date-range

Demo

View the DEMO

Builds

UMD

The default build with compiled styles in the .js file. Also minified version available in the lib/umd directory.

CommonJS/ES Module

You need to configure your module loader to use cjs or es fields of the package.json to use these module types. Also you need to configure sass loader, since all the styles are in sass format.

API

| Prop name | Type | Default | Description | | ------------- | ------------------ | -------- | ---------------------------------------- | | id | string | required | ID for the DOM element | | absoluteRange | absoluteRangeShape | | Properties for absolute range | | className | string | '' | Class for the DOM element | | enabled | enabledShape | '' | Properties for enabling range types | | inputProps | object | {} | Custom props for the input field | | inputRef | function | | Input component ref function | | onChange | function | | onChange callback returns new date range | | period | periodShape | | Properties for period | | relativeRange | relativeRangeShape | | Properties for relative range | | translations | translationsShape | | Translations | | width | string | '200px' | Width of the date range input field |

  • absoluteRangeShape:

| Prop name | Type | Default | Description | | -------------- | -------- | ---------- | ----------------------------------------------------------------------------------------------------- | | className | string | '' | The class attribute of the element | | dateFormat | string | 'M/D/YYYY' | Date format as MomentJS format | | endDate | string | '' | End date | | numberOfMonths | number | 2 | The number of months to render format | | onChange | function | | onChange callback | | region | string | 'en_GB' | Language region | | showOverlay | number | 0 | 0: no calender, 1: first day calendar, 2: last day calendar open by default | | showWeekNumber | boolean | true | Show week number in calendar | | startDate | string | '' | Start date |

  • enabledShape:

| Prop name | Type | Default | Description | | --------- | ---- | ------- | ----------------------------------- | | absolute | bool | true | True, if absolute range is enabled. | | period | bool | false | True, if period is enabled. | | relative | bool | false | True, if relative range is enabled. |

  • periodShape:

| Prop name | Type | Default | Description | | --------- | ----------------- | ------- | ----------------- | | endDate | periodDateShape | | End date | | onChange | function | | onChange callback | | startDate | relativeDateShape | | Start date |

  • periodDateShape:

| Prop name | Type | Default | Description | | --------- | ------ | -------- | ------------------------------------------------------------------- | | unit | enum | required | 'DAY', 'WEEK' or 'MONTH' | | timing | number | required | Negative or positive integer | | moment | enum | required | 'END' if timing is positive, 'START' if timing is negative integer. | | periodic | bool | true | True, if date is periodic. |

  • relativeDateShape:

| Prop name | Type | Default | Description | | --------- | ---- | -------- | -------------------------------- | | unit | enum | required | 'DAY', 'WEEK', 'MONTH' or 'YEAR' | | timing | enum | required | 'PREVIOUS', 'CURRENT' or 'NEXT' | | moment | enum | required | 'END' or 'START' |

  • relativeRangeShape:

| Prop name | Type | Default | Description | | --------- | ----------------- | ------- | ----------------- | | endDate | relativeDateShape | | End date | | onChange | function | | onChange callback | | startDate | relativeDateShape | | Start date |

  • translationsShape:

| Prop name | Type | Default | Description | | -------------------- | ---------------------- | ----------- | ------------------------------- | | absolute | string | 'Absolute' | Absolute range label | | dates | datesTranslationsShape | | | | day | dayTranslationShape | | | | endDate | string | 'Last day' | Last date label | | endDatePlaceholder | string | 'Select...' | Placeholder of select component | | from | string | 'From' | From date label | | month | monthTranslationShape | | | | period | string | 'Period' | Period label | | relative | string | 'Relative' | Relative range label | | startDate | string | 'First day' | First date label | | startDatePlaceholder | string | 'Select...' | Placeholder of select component | | to | string | 'To' | To label | | week | weekTranslationShape | | | | ok | string | 'OK' | OK button label |

  • datesTranslationsShape:

| Prop name | Type | Default | Description | | ----------------------- | ------ | ----------------------------- | ----------- | | endOfTheCurrentMonth | string | 'End of the current month' | | | endOfTheCurrentWeek | string | 'End of the current week' | | | endOfTheCurrentYear | string | 'End of the current year' | | | endOfTheNextMonth | string | 'End of the next month' | | | endOfTheNextWeek | string | 'End of the next week' | | | endOfTheNextYear | string | 'End of the next year' | | | endOfThePreviousMonth | string | 'End of the previous month' | | | endOfThePreviousWeek | string | 'End of the previous week' | | | endOfThePreviousYear | string | 'End of the previous year' | | | startOfTheCurrentMonth | string | 'Start of the current month' | | | startOfTheCurrentWeek | string | 'Start of the current week' | | | startOfTheCurrentYear | string | 'Start of the current year' | | | startOfTheNextMonth | string | 'Start of the next month' | | | startOfTheNextWeek | string | 'Start of the next week' | | | startOfTheNextYear | string | 'Start of the next year' | | | startOfThePreviousMonth | string | 'Start of the previous month' | | | startOfThePreviousWeek | string | 'Start of the previous week' | | | startOfThePreviousYear | string | 'Start of the previous year' | | | today | string | 'Today' | | | tomorrow | string | 'Tomorrow' | | | yesterday | string | 'Yesterday' | |

  • dayTranslationShape:

| Prop name | Type | Default | Description | | --------- | ------ | ------- | ----------------------- | | plural | string | 'days' | Label for plural of day | | singular | string | 'day' | Label for single day |

  • monthTranslationShape:

| Prop name | Type | Default | Description | | --------- | ------ | -------- | ------------------------- | | plural | string | 'months' | Label for plural of month | | singular | string | 'month' | Label for single month |

  • weekTranslationShape:

| Prop name | Type | Default | Description | | --------- | ------ | ------- | ------------------------ | | plural | string | 'weeks' | Label for plural of week | | singular | string | 'week' | Lable for single week |

Code example

import React from 'react';
import DateRange from '@opuscapita/react-date-range';

export default class DateRangeView extends React.Component {
  render() {
    return (
      <DateRange
        id="id"
      />
    );
  }
}