Default Props Table

PropTypeDescriptions
positionStringcurrent position of the plugin
nodesObjectto determine if there is another plugin around the current plugin
CalendarHTML Div Element
DatePickerHTML Div Element
calendarPropsObject
datePickerPropsObject
stateObjectthe state of the calendar
setStateFunction
registerListenerFunction
handleChangeFunctionif you want to trigger a change event
handlePropsChangeFunctionif you want to trigger a props change event
handleFocusedDateFunctionif you want to trigger a focus change event

Calendar & DatePicker

Contain the HTML elements of the calendar and date picker, each of them is stored separately in its own ref.

For example, because the closeCalendar function is in the DatePicker ref. it can be used to closing the calendar from your plugin.

Just note that if the user uses your plugin in the Calendar instead of DatePicker, the DatePicker and datePickerProps will be undefined.

import React from "react";
import DatePicker from "react-multi-date-picker";

function MyPlugin({ DatePicker }) {
  return (
    <div>
      <button
        style={{ margin: "5px" }}
        disabled={!DatePicker}
        onClick={() => DatePicker.closeCalendar()}
      >
        Close
      </button>
    </div>
  );
}

export default function Example() {
  return (
    <DatePicker 
      plugins={[
        <MyPlugin position="bottom" />
      ]} 
    />
  )
}

calendarProps & datePickerProps

The point about these two properties is that the value of datePickerProps always takes precedence over the value of calendarProps. Because DatePicker changes some props of Calendar.

To determine whether you should use calendarProps or datePickerProps, it is better to follow the example below:

function MyPlugin({ datePickerProps, calendarProps }) {
  const props = datePickerProps || calendarProps

  ...
}

State Prop

An object that contains the data that is required by the calendar.

The properties of this object are written in the table below.

Note that the type of any of these properties should not be changed.

PropertyTypeDescriptions
dateDateObject

The date displayed by the calendar

selectedDateDateObject or DateObject[]

user-selected date(s)

multipleBoolean

Specifies whether it is in multiple or range mode.

If you want to change the value of any of these properties to true, you must change the value of the selectedDate from DateObject to DateObject[].

rangeBoolean
onlyMonthPickerBoolean
onlyYearPickerBoolean
initialValue-
value-
focusedDateObject or undefined

the date that is focused by the user

calendarObject Calendar
localeObject Locale
formatString
yearNumber
todayDateObject

changing this value interferes with calendar performance