Opening Calendar On The Specified Date

The currentDate prop allows you to open the calendar view directly to a specified date. This does not set the selected date, it only determines the initial calendar view.

For example, if you want the calendar to open to February 2021, you can set currentDate to a DateObject like this:

<DatePicker
  currentDate={
    new DateObject({ 
      year: 2021,
      month: 2,
      day: 1
    })
  }
/>

Manually Set Year And Month In DatePicker

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

export default function Example() {
  const [date, setDate] = useState(
    new DateObject(),
  );

  function update(key, value) {
    date[key] += value;

    setDate(new DateObject(date));
  }

  const style = {
    display: "inline-block",
    width: "90px",
    fontSize: "16px",
  };

  return (
    <div style={{ textAlign: "center" }}>
      <div>
        <button onClick={() => update("month", 1)}>+</button>
        <span style={style}>{date.month.name}</span>
        <button onClick={() => update("month", -1)}>-</button>
      </div>
      <div>
        <button onClick={() => update("year", 1)}>+</button>
        <span style={style}>{date.year}</span>
        <button onClick={() => update("year", -1)}>-</button>
      </div>
      <DatePicker 
        currentDate={date}
        calendarPosition="bottom-center"
      />
    </div>
  )
}  
October
2023

Changing Start Day Of The Week

You can use the weekStartDayIndex property to change the start day of the week.

For example, if you want the start day of the week to be Monday, you should set the weekStartDayIndex value to 1.

The value of weekStartDayIndex must be a number between 0 and 6.

<DatePicker 
  weekStartDayIndex={1} 
/>

Other Days

<DatePicker 
  showOtherDays 
/>

Custom Month Year Separator

<DatePicker 
  monthYearSeparator="|" 
/>

Disabling Today Highlight

<DatePicker 
  highlightToday={false}
  onOpenPickNewDate={false}
/>

Displaying Week Numbers

<DatePicker 
  displayWeekNumbers
  weekNumber="WN" 
/>

Disabling Scroll Sensitivity

Using this prop sets the fixMainPosition value true while scrolling.

<DatePicker 
  scrollSensitive={false} 
/>

Full Year View

<Calendar 
  fullYear 
/>

Hide On Scroll

<DatePicker 
  hideOnScroll 
/>

Ignore Formatting

<DatePickers
  format="Date:YYYY/MM/DD, Time:HH:mm:ss"
  formattingIgnoreList={["Date", "Time"]}
  plugins={[
    <TimePicker position="bottom" />
  ]}
/>

Disable Virtual Keyboard

<DatePicker
  inputMode="none"
/>

Disable Editing

This feature only affects input in single mode.

<DatePicker
  editable={false}
/>

Placeholder

<DatePicker
  placeholder="click to open"
/>

Disable Year Picker

<DatePicker 
  disableYearPicker 
/>

Disable Month Picker

<DatePicker 
  disableMonthPicker 
/>

Hiding Year From Header

<DatePicker 
  hideYear 
/>

Hiding Month From Header

<DatePicker 
  hideMonth 
/>

Hiding Week Days

<DatePicker 
  hideWeekDays 
/>

Read Only DatePicker

<DatePicker 
  value={new Date()} 
  readOnly
/>

Read Only Calendar

Both readOnly and disabled props prevent the user from selecting a new date, except that in readOnly mode, the calendar header remains active, but in disabled mode, the calendar header is also disabled.

<Calendar
  value={[
    new DateObject().toFirstOfWeek(),
    new DateObject().toLastOfWeek(),
  ]}
  range
  readOnly
/>

Disabled Calendar

<Calendar 
  value={new DateObject()} 
  disabled 
/>

Disabled Input

<DatePicker 
  disabled 
/>