1.2.11 • Published 11 months ago

@nejadipour/react-modern-datepicker v1.2.11

Weekly downloads
-
License
MIT
Repository
github
Last release
11 months ago

react-modern-datepicker

A simple and reusable Datepicker component for React.\ This package is an updated version of react-modern-calendar-datepicker with some additional features and bug fixes.

Installation

npm install @nejadipour/react-modern-datepicker

Usage

import Datepicker from "@nejadipour/react-modern-datepicker";

export default function Usage() {
    return (
        <Datepicker darkMode locale={"fa"}/>
    )
}

Documentation

You can find the base documentation here. Some additional features are added to the original package, you can find the properties details in the table below:

PropTypeDefaultDescription
alwaysOpenbooleanfalseIf true, the datepicker will always be open
arrowbooleantrueIf true, the arrow will be shown in the Popover
calendarClassNameString''Additional CSS class for the calendar element
calendarRangeBetweenClassNameString''Additional CSS class for the range-between day(s) in the range date picker
calendarRangeEndClassNameString''Additional CSS class for the range end day in the range date picker
calendarRangeStartClassNameString''Additional CSS class for the range start day in the range date picker
calendarSelectedDayClassNameString''Additional CSS class for the selected day
calendarTodayClassNameString''Additional CSS class for today day
closedViewString'text'The view that is shown when the date picker is closed. It can be one of 'text', 'button' and 'input'. alwaysOpen should be False
closedViewClassNameString''Additional CSS class for the closed view element
closedViewPropsObject{}Additional props for the closed view element based on Ant Design components.
colorPrimaryString'#1677ff'The color of selected day in the single date picker and the color of range start and range end in range date picker
colorPrimaryLightString'#64a9f9'The color of range-between days
customDaysClassNameArray[]An array of custom class names for your days. Each item is an object which contains day(number), month(number), year(number), and className(string) properties
darkModeBooleanFalseIf True, the date picker will be in dark mode
defaultValueObjectnullThe default value of the date picker. It should be an object with year, month, and day or an string of them separated by the delimiter. Based on the selectionMode, it can be an array or object with from and to
delimiterString'-'The delimiter that separates year, month, and day in the date string. This is shown when the datepicker is closed
disabledBooleanFalseIf True, the date picker will be disabled
disabledDaysArray[]An array of disabled calendar days. Disabled days won't be selectable, and they can't be included in a day range. If user tries to select/include them onDisabledDayError will be called
localeString'en'Locale language of the calendar. It can be one of 'fa' or 'en'
maximumDateObjectnullSpecifies the maximum selectable day by user
maximumTodayBooleanFalseIf True, the maximum date will be set to today
maximumTomorrowBooleanFalseIf True, the maximum date will be set to tomorrow
minimumDateObjectnullSpecifies the minimum selectable day by user
minimumTodayBooleanFalseIf True, the minimum date will be set to today
minimumTomorrowBooleanFalseIf True, the minimum date will be set to tomorrow
onChangeFunctionnewValue => nullGets called when the value of the picker changes
onDisabledDayErrorFunctiondisabledDay => nullGets called when user tries to select/include a disabled day
onRenderReadyFunction() => nullGets called when the date picker render is ready or changed
placeholderString'select' for 'en' and 'انتخاب' for 'fa'The placeholder of the date picker
placementString'bottom'The placement of the date picker. It can be one of 'top', 'bottom', 'left', 'right', 'topLeft', 'topRight', 'bottomLeft', 'bottomRight', 'leftTop', 'leftBottom', 'rightTop' or 'rightBottom'
popoverBooleantrueIf true, the date picker will be open in a popover, else it will be replaced with the closed view
renderInputFunctionnullCustom render of the input. The function should accept props of input component and support it
renderFooterFunction() => nullRenders a footer for the calendar below the days list. You can use this prop to render a "Go to Today" button or anything you'd like to add there.
returnTypeString'string'The type of the when calling onChange. It can be one of 'string' or 'object'
selectionModeString'single'The selection mode of the date picker. It can be one of 'single', 'range', or 'multiple'
selectorEndingYearNumbercurrent year + 50The maximum selectable year when user opens the year selector
selectorStartingYearNumbercurrent year - 100The minimum selectable year when user opens the year selector
shouldHighlightWeekendsBooleanfalseDetermines whether to mark weekend days with red or not. (weekend days are Saturday and Sunday for locale="en" calendar and Friday for locale="fa" calendar)
slideAnimationDurationString'0.4s'Duration of month slide animation. It can be any CSS valid time value
showIconBooleantrueEither show the calendar icon in input view
tooltipPropsObjectnullprops of tooltips in calendar
triggerString"click"The trigger of the date picker to open/close it. It can be one of "click", "hover", "focus" or "contextMenu"
valueStringnullThe value of datepicker
wrapperClassNameString''Additional CSS class for the date picker wrapper element
1.2.11

11 months ago

1.2.10

11 months ago

1.2.9

11 months ago

1.2.8

11 months ago

1.2.7

11 months ago

1.2.6

11 months ago

1.2.5

11 months ago

1.2.4

11 months ago

1.2.3

1 year ago

1.2.2

1 year ago

1.2.1

1 year ago

1.2.0

1 year ago

1.0.3

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago