Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

react-multi-date-picker

Package Overview
Dependencies
Maintainers
1
Versions
142
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-multi-date-picker

a simple React datepicker component for working with gregorian, persian, arabic and indian calendars with the ability to select the date by single, multiple and range pickers.

  • 3.1.3
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
60K
decreased by-11.04%
Maintainers
1
Weekly downloads
 
Created
Source

DatePicker

Simple React datepicker component for working with gregorian, persian, arabic and indian calendars with the ability to select the date in single, multiple and range modes.

date picker

Layouts

You can change the appearance of the datepicker to prime or mobile by importing css files from the styles folder.

date picker layouts

Plugins

Ability to further customize the calendar and datepicker by adding one or more plugins.

date picker plugins all in one

Installation

npm install --save react-multi-date-picker

Demo

Usage

import React, { useState } from "react";
import DatePicker from "react-multi-date-picker";

export default function Example() {
  const [value, setValue] = useState(new Date());

  return <DatePicker value={value} onChange={setValue} />;
}

Browser (none react-app)

<!DOCTYPE html>
<html>
  <head>
    <meta charset="UTF-8" />
    <title>React Multi Date Picker</title>
  </head>
  <body>
    <span>Calendar Example :</span>
    <div id="calendar"></div>

    <span>DatePicker Example :</span>
    <div id="datePicker"></div>

    <span>Plugins Example :</span>
    <div id="datePickerWithPlugin"></div>

    <!-- Ract -->
    <script src="https://unpkg.com/react@17/umd/react.production.min.js"></script>
    <script src="https://unpkg.com/react-dom@17/umd/react-dom.production.min.js"></script>

    <!-- DatePicker and dependencies-->
    <script src="https://cdn.jsdelivr.net/npm/date-object@latest/dist/umd/date-object.min.js"></script>
    <script src="https://cdn.jsdelivr.net/npm/react-element-popper@latest/build/browser.min.js"></script>
    <script src="https://cdn.jsdelivr.net/npm/react-multi-date-picker@latest/build/browser.min.js"></script>

    <!-- Optional Plugin -->
    <script src="https://cdn.jsdelivr.net/npm/react-multi-date-picker@latest/build/date_picker_header.browser.js"></script>

    <script>
      const { DatePicker, Calendar } = ReactMultiDatePicker;

      ReactDOM.render(
        React.createElement(Calendar),
        document.getElementById("calendar")
      );

      ReactDOM.render(
        React.createElement(DatePicker),
        document.getElementById("datePicker")
      );

      ReactDOM.render(
        React.createElement(DatePicker, {
          plugins: [React.createElement(DatePickerHeader)],
        }),
        document.getElementById("datePickerWithPlugin")
      );
    </script>
  </body>
</html>

Availble props

NameTypeDefaultAvailability (DatePicker/ Calendar)
value Date, DateObject , String, Number or Array new Date()both
refReact.RefObjectboth
multipleBooleanfalse (true if value is Array)both
rangeBooleanfalseboth
onlyMonthPickerBooleanfalseboth
onlyYearPickerBooleanfalseboth
formatStringYYYY/MM/DDboth
formattingIgnoreListArrayboth
localeStringenboth
calendarStringgregorianboth
mapDaysFunctionboth
onChangeFunctionboth
weekDaysArrayboth
monthsArrayboth
showOtherDaysBooleanfalseboth
minDateDate, DateObject, String or Numberboth
maxDateDate, DateObject, String or Numberboth
disableYearPickerBooleanfalseboth
disableMonthPickerBooleanfalseboth
zIndexNumber100both
pluginsArray[]both
sortBooleanfalseboth
numberOfMonthsNumber1both
currentDateDateObjectboth
digitsArrayboth
buttonsBooleantrueboth
renderButtonReact.ReactElement or Functionboth
weekStartDayIndexNumberboth
disableDayPickerBooleanfalseboth
onPropsChangeFunctionboth
onMonthChangeFunctionboth
onYearChangeFunctionboth
onFocusedDateChangeFunctionboth
classNameStringboth
readOnlyBooleanfalseboth
disabledBooleanfalseboth
hideMonthBooleanfalseboth
hideYearBooleanfalseboth
hideWeekDaysBooleanfalseboth
shadowBooleantrueboth
fullYearBooleanfalseboth
displayWeekNumbersBooleanfalseboth
weekNumberStringboth
weekPickerBooleanfalseboth
containerClassNameStringDatePicker
arrowClassNameString0DatePicker
styleReact.CSSProperties{}DatePicker
containerStyleReact.CSSPropertiesDatePicker
arrowStyleReact.CSSProperties0DatePicker
arrowBoolean or React.ReactElementtrueDatePicker
animationsArrayfalseDatePicker
inputClassStringDatePicker
nameStringDatePicker
idStringDatePicker
titleStringDatePicker
requiredBooleanDatePicker
placeholderStringDatePicker
renderReact.ReactElement or FunctionDatePicker
inputModeStringDatePicker
scrollSensitiveBooleantrueDatePicker
hideOnScrollBooleanfalseDatePicker
calendarPositionString"bottom-left"DatePicker
editableBooleantrueDatePicker
onlyShowInRangeDatesBooleantrueDatePicker
onOpenFunctionDatePicker
onCloseFunctionDatePicker
onPositionChangeFunctionDatePicker
fixMainPositionBooleanfalseDatePicker
fixRelativePositionBooleanfalseDatePicker
offsetYNumber0DatePicker
offsetXNumber0DatePicker
mobileLabelsObjectDatePicker

Calendars & Locales

Click here to see the descriptions.

CalendarsGregorianPersian (Solar Hijri)JalaliArabic (Lunar Hijri)Indian
/calendars/gregorian/calendars/persian/calendars/jalali/calendars/arabic/calendars/indian
LocalesEnglish/locales/gregorian_en/locales/persian_en/locales/persian_en/locales/arabic_en/locales/indian_en
Farsi/locales/gregorian_fa/locales/persian_fa/locales/persian_fa/locales/arabic_fa/locales/indian_fa
Arabic/locales/gregorian_ar/locales/persian_ar/locales/persian_ar/locales/arabic_ar/locales/indian_ar
Hindi/locales/gregorian_hi/locales/persian_hi/locales/persian_hi/locales/arabic_hi/locales/indian_hi

Of course, you can customize the names of the months and days of the week in the both calendar & input by using the months and weekDays Props.

Also, you can create a custom Calendar and Locale:

Keywords

FAQs

Package last updated on 01 Sep 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc