2.4.3 • Published 4 years ago

@opuscapita/react-date-range v2.4.3

Weekly downloads
1
License
MIT
Repository
github
Last release
4 years ago

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 nameTypeDefaultDescription
idstringrequiredID for the DOM element
absoluteRangeabsoluteRangeShapeProperties for absolute range
classNamestring''Class for the DOM element
enabledenabledShape''Properties for enabling range types
inputPropsobject{}Custom props for the input field
inputReffunctionInput component ref function
onChangefunctiononChange callback returns new date range
periodperiodShapeProperties for period
relativeRangerelativeRangeShapeProperties for relative range
translationstranslationsShapeTranslations
widthstring'200px'Width of the date range input field
  • absoluteRangeShape:
Prop nameTypeDefaultDescription
classNamestring''The class attribute of the element
dateFormatstring'M/D/YYYY'Date format as MomentJS format
endDatestring''End date
numberOfMonthsnumber2The number of months to render format
onChangefunctiononChange callback
regionstring'en_GB'Language region
showOverlaynumber00: no calender, 1: first day calendar, 2: last day calendar open by default
showWeekNumberbooleantrueShow week number in calendar
startDatestring''Start date
  • enabledShape:
Prop nameTypeDefaultDescription
absolutebooltrueTrue, if absolute range is enabled.
periodboolfalseTrue, if period is enabled.
relativeboolfalseTrue, if relative range is enabled.
  • periodShape:
Prop nameTypeDefaultDescription
endDateperiodDateShapeEnd date
onChangefunctiononChange callback
startDaterelativeDateShapeStart date
  • periodDateShape:
Prop nameTypeDefaultDescription
unitenumrequired'DAY', 'WEEK' or 'MONTH'
timingnumberrequiredNegative or positive integer
momentenumrequired'END' if timing is positive, 'START' if timing is negative integer.
periodicbooltrueTrue, if date is periodic.
  • relativeDateShape:
Prop nameTypeDefaultDescription
unitenumrequired'DAY', 'WEEK', 'MONTH' or 'YEAR'
timingenumrequired'PREVIOUS', 'CURRENT' or 'NEXT'
momentenumrequired'END' or 'START'
  • relativeRangeShape:
Prop nameTypeDefaultDescription
endDaterelativeDateShapeEnd date
onChangefunctiononChange callback
startDaterelativeDateShapeStart date
  • translationsShape:
Prop nameTypeDefaultDescription
absolutestring'Absolute'Absolute range label
datesdatesTranslationsShape
daydayTranslationShape
endDatestring'Last day'Last date label
endDatePlaceholderstring'Select...'Placeholder of select component
fromstring'From'From date label
monthmonthTranslationShape
periodstring'Period'Period label
relativestring'Relative'Relative range label
startDatestring'First day'First date label
startDatePlaceholderstring'Select...'Placeholder of select component
tostring'To'To label
weekweekTranslationShape
okstring'OK'OK button label
  • datesTranslationsShape:
Prop nameTypeDefaultDescription
endOfTheCurrentMonthstring'End of the current month'
endOfTheCurrentWeekstring'End of the current week'
endOfTheCurrentYearstring'End of the current year'
endOfTheNextMonthstring'End of the next month'
endOfTheNextWeekstring'End of the next week'
endOfTheNextYearstring'End of the next year'
endOfThePreviousMonthstring'End of the previous month'
endOfThePreviousWeekstring'End of the previous week'
endOfThePreviousYearstring'End of the previous year'
startOfTheCurrentMonthstring'Start of the current month'
startOfTheCurrentWeekstring'Start of the current week'
startOfTheCurrentYearstring'Start of the current year'
startOfTheNextMonthstring'Start of the next month'
startOfTheNextWeekstring'Start of the next week'
startOfTheNextYearstring'Start of the next year'
startOfThePreviousMonthstring'Start of the previous month'
startOfThePreviousWeekstring'Start of the previous week'
startOfThePreviousYearstring'Start of the previous year'
todaystring'Today'
tomorrowstring'Tomorrow'
yesterdaystring'Yesterday'
  • dayTranslationShape:
Prop nameTypeDefaultDescription
pluralstring'days'Label for plural of day
singularstring'day'Label for single day
  • monthTranslationShape:
Prop nameTypeDefaultDescription
pluralstring'months'Label for plural of month
singularstring'month'Label for single month
  • weekTranslationShape:
Prop nameTypeDefaultDescription
pluralstring'weeks'Label for plural of week
singularstring'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"
      />
    );
  }
}
2.4.3

4 years ago

2.4.2

4 years ago

2.4.1

4 years ago

2.4.0

4 years ago

2.3.2

4 years ago

2.3.1

4 years ago

2.3.0

5 years ago

2.2.3

5 years ago

2.2.2

5 years ago

2.2.1

5 years ago

2.2.0

5 years ago

2.1.3

5 years ago

2.1.2

5 years ago

2.1.1

5 years ago

2.1.0

5 years ago

2.0.9

5 years ago

2.0.8

5 years ago

2.0.7

5 years ago

2.0.6

5 years ago

2.0.5

5 years ago

2.0.4

5 years ago

2.0.3

5 years ago

2.0.2

5 years ago

2.0.1

5 years ago

2.0.0

5 years ago

1.1.1

6 years ago

1.1.0

6 years ago

1.0.4

6 years ago

1.0.3

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago