1.0.1 • Published 5 years ago

react-range-picker v1.0.1

Weekly downloads
221
License
MIT
Repository
github
Last release
5 years ago

React Js based date/range picker, unlike other range pickers it uses single calendar to select the range. Click here to see it in action

install

$ npm i react-range-picker --save

use

import RangePicker from "react-range-picker"

<RangePicker/>

APIS

APITypeDescription
defaultValueobjectset default values for the calendar - {startDate: Date, endDate: Date}
onDateSelectedfunctiongets called each time date/time gets selected (params - startDate, startDate)
onClosefunctiongets called when calendar closes or ok/select button is pressed
closeOnSelectbooleanif true picker will hide on select of a date or range (default false)
disableRangebooleanif true user can select only one date (default false)
selectTimebooleanif true, time select will show up on date select (default false)
rangeTillEndOfDaybooleanif true, then second selected date for range will have time of end of the day (11.59 PM) else it will have time of start of the day (12:00 AM)
placeholderfunction => ReactComponentchange placeholder, placeholder function will recieve following object as param - {startDate (date object),endDate (date object)}
placeholderTextstringreplaces placeholder default text
dateFormatstringformat of placeholder date
footerfunction => ReactComponentchange footer, footer function will recieve following object as param - {startDate (date object), endDate (date object),today (function) - to select today's date, close (function) - closes the calendar and calls, onClose callback passed by user}

Followings are the variables for the date format.

  • dd - date
  • DD - day short
  • DDDD - day full
  • mm - month
  • MM - month short
  • MMMM - month full
  • yyyy or YYYY - full year
  • h - hours
  • mi - minutes
  • a - lowercase period (am),
  • A - capital period (AM)