Gathering detailed insights and metrics for @ijavad805/react-datepicker
Gathering detailed insights and metrics for @ijavad805/react-datepicker
Gathering detailed insights and metrics for @ijavad805/react-datepicker
Gathering detailed insights and metrics for @ijavad805/react-datepicker
npm install @ijavad805/react-datepicker
Typescript
Module System
Node Version
NPM Version
64.8
Supply Chain
91.8
Quality
83.2
Maintenance
100
Vulnerability
98.9
License
TypeScript (79.62%)
SCSS (18.43%)
JavaScript (1.95%)
Love this project? Help keep it running — sponsor us today! 🚀
Total Downloads
14,680
Last Day
7
Last Week
128
Last Month
520
Last Year
6,424
35 Stars
176 Commits
5 Forks
1 Watching
14 Branches
1 Contributors
Minified
Minified + Gzipped
Latest Version
2.2.18
Package Id
@ijavad805/react-datepicker@2.2.18
Unpacked Size
1.01 MB
Size
270.37 kB
File Count
85
NPM Version
10.5.2
Node Version
20.13.1
Publised On
07 Oct 2024
Cumulative downloads
Total Downloads
Last day
-66.7%
7
Compared to previous day
Last week
-11.1%
128
Compared to previous week
Last month
36.5%
520
Compared to previous month
Last year
24.9%
6,424
Compared to previous year
3
35
A cool datepicker and calendar for english and persian you can see some features here :
🌟 If you like this Datepicker, please bookmark it on your github with the star button.
Use the package manager npm to install @ijavad805/react-datepicker.
1npm install @ijavad805/react-datepicker
1import { Datepicker } from '@ijavad805/react-datepicker'; 2// simple 3function AppSimple() { 4 return <Datepicker />; 5} 6 7// full options 8function App() { 9 return ( 10 <Datepicker 11 footer={(moment, setValue) => { 12 return ( 13 <> 14 <div 15 onClick={() => { 16 if (setValue) setValue(moment()); 17 }} 18 > 19 Today 20 </div> 21 </> 22 ); 23 }} 24 closeWhenSelectADay={true} // boolean 25 dayEffects={[ 26 { 27 day: '2022-09-12', 28 color: 'red', 29 dotColor: 'red', 30 title: 'What ever you want', 31 }, 32 ]} 33 disabled={false} // disable input 34 disabledDate={(day) => day === moment()} // today should be disabled 35 format={'YYYY-MM-DD'} 36 input={<input placeholder="Select a date" />} // whatever you want 37 onOpen={() => { 38 console.log('datepicker is open'); 39 }} 40 lang={'en'} // en and fa 41 loading={false} // show loading in datepicker if is open 42 modeTheme={'dark'} // dark and light 43 theme={'blue'} // blue , orange , red , green , yellow 44 defaultValue={moment()} 45 adjustPosition={'auto'} // auto, right-top, left-top, right-bottom, left-bottom, modal 46 onChange={(val: any) => { 47 console.log(val.format()); 48 }} 49 /> 50 ); 51}
The Calendar props interface provides configuration options for customizing the behavior and appearance of the react-datepicker
component. Here's a summary of its properties:
Property | Type | Description |
---|---|---|
lang | "en" | "fa" | Language for the calendar. Either "en" for English or "fa" for Farsi (Persian). |
theme | "blue" | Theme for the calendar. Currently, only "blue" is supported. |
events | IEvent[] | An array of IEvent objects representing the events to be displayed on the calendar. |
onDay | (date: string) => { className?: string; } | A function to customize the appearance of a day. It takes a date string as input and should return an object with an optional className property to apply custom styles. |
disabledDate | (date: moment.Moment) => boolean | A function that determines whether a date should be disabled. It takes a Moment.js date object as input and should return true to disable the date or false to enable it. |
onClickEvent | (item: IEvent) => void | A function to handle event click events. It receives an IEvent object as its argument. |
onDoubleClickEvent | (item: IEvent) => void | A function to handle event double-click events. It receives an IEvent object as its argument. |
onDropEvent | (item: IEvent) => void | A function to handle event drop events. It receives an IEvent object as its argument, to enable drag and drop functionality, this prop should not be undefined |
onDateClick | (date: string) => void | A function to handle date click events. It receives a date string as its argument. |
onMonthChange | (start: string, end: string) => void | A function to handle month change events. It receives two date strings, start and end , indicating the new visible date range on the calendar. |
style | React.CSSProperties | Additional CSS styles to apply to the calendar component. |
allowClear | boolean | allow user to clear the value |
These properties allow you to configure and customize the behavior and appearance of the Calendar
component in your application.
IEvent
InterfaceThe IEvent
interface represents an individual event that can be displayed on the calendar. It provides details about the event. Here's a summary of its properties:
Property | Type | Description |
---|---|---|
id | number | A unique identifier for the event. |
title | React.ReactNode | string | The title of the event, which can be either a Component or a string. |
date | DateEvent | The date of the event, which can be a date string or an object with start and end properties. |
style | React.CSSProperties | Additional CSS styles for the event. |
className | string | Additional CSS class for the event. |
dotColor | string | Color for a dot associated with the event. |
disabled | boolean | A flag indicating if the event is disabled. |
icon | React.ReactNode | A React node for an icon associated with the event. |
These properties allow you to specify the details and appearance of events to be displayed on the calendar.
1const App = () => { 2 return ( 3 <Calendar 4 lang="en" 5 theme="blue" 6 events={[ 7 { 8 id: 1, // it should unique 9 title: 'Test', 10 date: '2023-09-16', 11 className: 'test', 12 dotColor: '#000', 13 disabled: false, 14 icon: '$', // also you can use component 15 style: { 16 // what ever you want 17 }, 18 }, 19 ]} 20 onDropEvent={(item: IEvent) => { // for enabling drag and drop option you should pass this function 21 console.log(item); 22 }} 23 onClickEvent={(item: IEvent) => console.log(item)} 24 onDoubleClickEvent={(item: IEvent) => console.log(item)} 25 style={{ 26 height: 600, 27 }} 28 onDateClick={(date: moment.Moment) => console.log(date)} 29 /> 30 ); 31};
My friend, if you see any bugs, please tell me:
No vulnerabilities found.
No security vulnerabilities found.