You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

react-calendar-datetime-picker

Package Overview
Dependencies
Maintainers
0
Versions
36
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-calendar-datetime-picker

A fast and small calendar for react

1.7.5
latest
Source
npmnpm
Version published
Weekly downloads
334
-29.09%
Maintainers
0
Weekly downloads
 
Created
Source

react-calendar-datetime-picker

The Simple and fast English and Persian calender for React

version: "1.7.5" NPM JavaScript Style Guide

⚙️ Install

npm install react-calendar-datetime-picker
or
yarn add react-calendar-datetime-picker

⚡️ Usage

import { DtPicker } from 'react-calendar-datetime-picker'
import 'react-calendar-datetime-picker/dist/style.css'

const App = () => {
  const [date, setDate] = useState(null)
  return <DtPicker onChange={setDate} />
}

📄 Documentation

Documentation with examples

🎯 Features

  • Supports Gregorian and Jalali calender
  • Uses context api to share data
  • Supports three types of calender: single day - date range - multiple dates
  • Fully customizable
  • Supports maximum and minimum dates
  • Capability to add a list of disabled dates
  • Supports time for single and range type
  • Capability to mark weekends
  • Function called for change, open and close events
  • Supports Typescript


🔧 Props

PropertyTypeRequiredDefaultDescription
onChangefunctrue-A function that returns an object of selected date/dates.
initValueDaynullnull
typestringsingleYou can choose the selection type that you need to use. There exist 3 types: "single", "range", "multi"
localstringenThis date picker supports both Gregorian and Jalali calenders.To select Gregorian calendar you have to set "local" to "en" and to "fa" for Jalali.
withTimebooleanfalseShould you need to use time in your date picker you can set this prop to true.This prop works only in single and range types.
showTimeInputbooleanfalseHelps you to show time in input date picker
showWeekendbooleanfalseMarks weekends by changing the color.
clearBtnbooleanfalseAdd a button to your input to clear you calendar initial date/dates.
isRequiredbooleanfalseThis prop makes your input as a required field in the form validation
todayBtnbooleanfalseA button to move fast to the date of today in the calendar.
onCalenderChangefuncA callback that runs when the calendar value is changed
onCalenderShowfuncA callback that runs when the calendar opens
onCalenderHidefuncA callback that runs when the calendar closes
maxDateDayYou can set this prop to limit the maximum date that the user can select.Periods partially overlapped by maxDate will also be selectable, although React-calendar-dateTime-picker will ensure that no later date is selected.
minDateDayYou can set this prop to limit the minimum date that the user can select. Periods partially overlapped by minDate will also be selectable, although React-calendar-dateTime-picker will ensure that no earlier date is selected.
disabledDatesDay[]A list of dates that you want the user not to select.
isDisabledbooleanfalseUse to disable the calendar input
yearListStylestringgridUse to change year item list style(accepted value: grid, list)

🎨 Customization

PropertyTypeDefaultDescription
placeholderstring"select"To change input date picker placeholder
inputClassstringTo change calendar's input style
clearBtnClassstringTo change calendar's clear button style
calenderModalClassstringTo change calendar's main modal style
headerClassstringTo change calendar's green header style
timeClassstringTo change calendar's time view style
daysClassstringTo change calendar's days view style
monthsClassstringTo change calendar's months view style
yearsClassstringTo change calendar's years view style
NextBtnIconsvg as component">"To change next month button icon.
PreviousBtnIconsvg as component"<"To change previous month button icon.
nextMonthBtnTitlestring"next"To change next month button title(shows by hover).
previousMonthBtnTitlestring"previous"To change previous month button title(shows by hover).
fromLabelstring"from"Starting date label in input result(works only in range type).
toLabelstring"to"Ending date label in input result(works only in range type).
clockFromLabelstring"from"Title for starting time in the time component(works only in range type).
clockToLabelstring"to"Title for ending time in the time component(works only in range type).
clockLabelstring"clock"Label for time in the time component(works in single and range type).



✔️ bundle size

You can check out this package bundle size in this Link

🙇 Special Thanks

Thanks to jalaali-js, the only dependency of this date picker.

📋 License

MIT © mehdinasiri

Keywords

persian date picker

FAQs

Package last updated on 23 Feb 2025

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