Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

a simple React datepicker component for working with gregorian, persian, arabic and indian calendars

License

NotificationsYou must be signed in to change notification settings

shahabyazdi/react-multi-date-picker

Repository files navigation

Simple React datepicker component for working withgregorian,persian,arabic andindian calendarswith the ability to select the date insingle,multiple,range andmultiple range modes.

date picker

Layouts

You can change the appearance of the datepicker toprime ormobile 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 i react-multi-date-picker

Demo

Usage

importReact,{useState}from"react";importDatePickerfrom"react-multi-date-picker";exportdefaultfunctionExample(){const[value,setValue]=useState(newDate());return<DatePickervalue={value}onChange={setValue}/>;}

Browser (non react-app)

<!DOCTYPE html><html><head><metacharset="UTF-8"/><title>React Multi Date Picker</title></head><body><span>Calendar Example :</span><divid="calendar"></div><span>DatePicker Example :</span><divid="datePicker"></div><span>Plugins Example :</span><divid="datePickerWithPlugin"></div><!-- Ract --><scriptsrc="https://unpkg.com/react@17/umd/react.production.min.js"></script><scriptsrc="https://unpkg.com/react-dom@17/umd/react-dom.production.min.js"></script><!-- DatePicker and dependencies--><scriptsrc="https://cdn.jsdelivr.net/npm/date-object@latest/dist/umd/date-object.min.js"></script><scriptsrc="https://cdn.jsdelivr.net/npm/react-element-popper@latest/build/browser.min.js"></script><scriptsrc="https://cdn.jsdelivr.net/npm/react-multi-date-picker@latest/build/browser.min.js"></script><!-- Optional Plugin --><scriptsrc="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>

Available props

NameTypeDefaultAvailability (DatePicker/ Calendar)
value Date, DateObject , String, Number or Arraynew Date()both
refReact.RefObjectboth
multipleBooleanfalse (true if value is Array)both
rangeBooleanfalseboth
onlyMonthPickerBooleanfalseboth
onlyYearPickerBooleanfalseboth
formatStringYYYY/MM/DDboth
formattingIgnoreListArrayboth
calendarObjectgregorianboth
localeObjectgregorian_enboth
mapDaysFunctionboth
onChangeFunctionboth
onPropsChangeFunctionboth
onMonthChangeFunctionboth
onYearChangeFunctionboth
onFocusedDateChangeFunctionboth
digitsArrayboth
weekDaysArrayboth
monthsArrayboth
showOtherDaysBooleanfalseboth
minDateDate, DateObject, String or Numberboth
maxDateDate, DateObject, String or Numberboth
disableYearPickerBooleanfalseboth
disableMonthPickerBooleanfalseboth
disableDayPickerBooleanfalseboth
zIndexNumber100both
pluginsArray[]both
sortBooleanfalseboth
numberOfMonthsNumber1both
currentDateDateObjectboth
buttonsBooleantrueboth
renderButtonReact.ReactElement or Functionboth
weekStartDayIndexNumberboth
classNameStringboth
readOnlyBooleanfalseboth
disabledBooleanfalseboth
hideMonthBooleanfalseboth
hideYearBooleanfalseboth
hideWeekDaysBooleanfalseboth
shadowBooleantrueboth
fullYearBooleanfalseboth
displayWeekNumbersBooleanfalseboth
weekNumberStringboth
weekPickerBooleanfalseboth
rangeHoverBooleanfalseboth
monthYearSeparatorString"," for LTR locales, "،" for RTL localesboth
formatMonthFunctionundefinedboth
formatYearFunctionundefinedboth
highlightTodayBooleantrueboth
styleReact.CSSProperties{}both
headerOrderArray["LEFT_BUTTON", "MONTH_YEAR", "RIGHT_BUTTON"]both
onOpenFunctionDatePicker
onCloseFunctionDatePicker
onPositionChangeFunctionDatePicker
containerClassNameStringDatePicker
arrowClassNameString0DatePicker
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
fixMainPositionBooleanfalseDatePicker
fixRelativePositionBooleanfalseDatePicker
offsetYNumber0DatePicker
offsetXNumber0DatePicker
mobileLabelsObjectDatePicker
portalBooleanDatePicker
portalTargetHTMLElementDatePicker
onOpenPickNewDateBooleantrueDatePicker
mobileButtonsHTMLButtonElement[][]DatePicker
dateSeparatorString'~' in range mode, ',' in multiple modeDatePicker
multipleRangeSeparatorString','DatePicker
typingTimeoutString700DatePicker
autoFocusBooleanfalseCalendar

Calendars & Locales

Clickhere 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
Portuguese - BRAZIL/locales/gregorian_pt_br----
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 weekin both the calendar & input by using themonths andweekDays Props.

Also, you can create a custom Calendar and Locale:


[8]ページ先頭

©2009-2025 Movatter.jp