Installations
npm install react-jalali-datepicker
Developer Guide
Typescript
No
Module System
CommonJS
Node Version
14.15.4
NPM Version
6.14.10
Score
54.3
Supply Chain
88.9
Quality
74.3
Maintenance
100
Vulnerability
98.6
License
Contributors
Unable to fetch Contributors
Languages
JavaScript (91.05%)
SCSS (8.44%)
Dockerfile (0.27%)
HTML (0.24%)
Love this project? Help keep it running — sponsor us today! 🚀
Developer
a-m-dev
Download Statistics
Total Downloads
10,252
Last Day
2
Last Week
2
Last Month
228
Last Year
1,344
GitHub Statistics
6 Stars
132 Commits
4 Forks
2 Watching
7 Branches
4 Contributors
Bundle Size
46.13 kB
Minified
10.03 kB
Minified + Gzipped
Package Meta Information
Latest Version
0.2.66
Package Id
react-jalali-datepicker@0.2.66
Unpacked Size
170.03 kB
Size
42.68 kB
File Count
5
NPM Version
6.14.10
Node Version
14.15.4
Total Downloads
Cumulative downloads
Total Downloads
10,252
Last day
-71.4%
2
Compared to previous day
Last week
-96.6%
2
Compared to previous week
Last month
14.6%
228
Compared to previous month
Last year
4.6%
1,344
Compared to previous year
Daily Downloads
Weekly Downloads
Monthly Downloads
Yearly Downloads
React Jalali Datepicker
A Simple jalali datepicker for React and React-native!
This package is all about datepickers for react and new features of it will release very soon like SinglePicker
, InputPicker
and so on!
The General Idea
This datepicker component has been developed in a way that currenly supports the Jalaali and global Gregorian calendars and the base idea was to provide a prop called isJalaali
, wich will accept a Boolean
, to datepicker to keep track of usage for that!
components
RangePicker
SinglePicker
- currently in developmentInputPicker
- currenly in development
RangePicker
This component main use case is for selecting a range from datepicker. our date picker has two locale which is based on Jalaali and Gregorian style whcih can be modefined by isJalaali
prop that is been passed to RangePicker
component. a simple use case of that would be like below:
1import { RangePicker } from "react-jalali-datepicker"; 2 3const YourComponent = () => { 4 return ( 5 <section> 6 <RangePicker isJalaali={true} /> 7 </section> 8 ); 9};
this will give you the Rangepicker
Component to use!
How to get Date out of this picker?
there is a prop that os been shipped with this component called onChangeRange
, which will accpet a function. the function will recieve an argument called selectedRange
which is an Object that contains two keys:
startDate
- selected start date, default will benull
stopDate
- selected stop date, default will benull
these are the selected range that is being selected from range picker! you can do what ever you want to do with them like save in state or send it through api call or what ever you want to do with it!
a simple use case is like below where we just destructure the startDate
and stopDate
from selectedRange
argument that is being passed to our handler and log it to the console:
1import { RangePicker } from "react-jalali-datepicker"; 2 3const YourComponent = () => { 4 // you can use `useCallback` here, but i just kept it simple 5 const rangeHandler = ({ startDate, stopDate }) => { 6 console.log("ON_CHANGE_RANGE: ", { startDate, stopDate }); 7 }; 8 9 return ( 10 <section> 11 <RangePicker isJalaali={true} onChangeRange={rangeHandler} /> 12 </section> 13 ); 14};
how to disable days before today?
RangePicker
component has a handy prop called shouldDisableBeforeToday
which recieves a Boolean
indicates that should the days before today be disabled or not! simple use case would be like below:
1import { RangePicker } from "react-jalali-datepicker"; 2 3const YourComponent = () => { 4 // you can use `useCallback` here, but i just kept it simple 5 const rangeHandler = ({ startDate, stopDate }) => { 6 console.log("ON_CHANGE_RANGE: ", { startDate, stopDate }); 7 }; 8 9 return ( 10 <section> 11 <RangePicker isJalaali={true} shouldDisableBeforeToday={true} /> 12 </section> 13 ); 14};
how to show more month in table?
there is a props called numberOfMonths
which most of the datepickers has these days, which will get a Number
and it shows the number of monthes since today, for example if we are in May and the passed number was 2 the the rangepicker shows the May and June.
how to pass default selected range?
there is a props called defaultSelectedRange
which will recieve an Object type with this shape:
1 2 { 3 startDate: null, 4 stopDate: null 5 } 6
keep in mind these important points
- the date might be in this format all time
YYYY-MM-DD
- if your
isJalaali
prop is true you might pass date in Jalaali format like1399-3-12
and in contrast if yourisJalaali
is false you might pass date in Gregorian format like2020-5-25
(also you can skip the leading 0 befor day and month it the day ot month has only one character); and for that you might have a mechanisem that keeps track ofisJalaali
and based on isJalaali it will give the proper values, you may needmoment-jalaali
for that to handle it in your side! and also note that there are some utils function likeconverDate
which you can pull from package to handle this part a simple useCase is like below:
1import { convertDate, DATE_FORMATS } from "react-jalali-datepicker"; 2 3const gregDate = "2020-5-25"; 4const jalaaliDate = "1399-3-5"; 5const { GEORGIAN_DATE_FORMAT, JALAALI_DATE_FORMAT } = DATE_FORMATS; 6const resultInJalaali = convertDate({ gregDate, GEORGIAN_DATE_FORMAT }); 7const resultInGregorian = convertDate({ jalaaliDate, GEORGIAN_DATE_FORMAT }); 8 9console.log(resultInJalaali); // 1399-3-5 10console.log(resultInGregorian); // 2020-5-25
some features of RangePicker component
- if you had a button that keeps track of
isJalaali
prop to convert tha datepicker type toJalaali
orGregorian
, theRangepicker
component wont lost the selected range between type cahnges, you alweays have your selected range in proper format! - you can put some custome styles on you rangepicker to make it fully custome! since it written in BEM, you can keep track of
.range-picker
class and replace the subsequent classnames. just inspect and get the classnames to see what i mean, i will put the classnames here as soon as possible!
I will update the documentation as soon as it is possible, jut DM me or find me on social with @a_m_dev!
![Empty State](/_next/static/media/empty.e5fae2e5.png)
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
0 existing vulnerabilities detected
Reason
license file detected
Details
- Info: project has a license file: LICENSE:0
- Info: FSF or OSI recognized license: MIT License: LICENSE:0
Reason
Found 4/26 approved changesets -- score normalized to 1
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
- Warn: no security policy file detected
- Warn: no security file to analyze
- Warn: no security file to analyze
- Warn: no security file to analyze
Reason
project is not fuzzed
Details
- Warn: no fuzzer integrations found
Reason
branch protection not enabled on development/release branches
Details
- Warn: branch protection not enabled for branch 'master'
Reason
dependency not pinned by hash detected -- score normalized to 0
Details
- Warn: containerImage not pinned by hash: Dockerfile:1
- Warn: containerImage not pinned by hash: Dockerfile:16: pin your Docker image by updating nginx:alpine to nginx:alpine@sha256:814a8e88df978ade80e584cc5b333144b9372a8e3c98872d07137dbf3b44d0e4
- Warn: npmCommand not pinned by hash: Dockerfile:10
- Info: 0 out of 2 containerImage dependencies pinned
- Info: 0 out of 1 npmCommand dependencies pinned
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
- Warn: 0 commits out of 8 are checked with a SAST tool
Score
2.9
/10
Last Scanned on 2025-02-03
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn MoreOther packages similar to react-jalali-datepicker
jalali-react-datepicker
React component that helps you to makes simple Farsi/Jalali/Shamsi date picker. It also has range date picker you can select multiple days in multiple months.
react-multi-date-picker
A simple React datepicker component for working with gregorian, persian, arabic and indian calendars with the ability to select the date by single, multiple, range and multiple range pickers.
@ijavad805/react-datepicker
cool datepicker and calendar for English and Persian
mr-jalali-react-datepicker
React component that helps you to makes simple Farsi/Jalali/Shamsi date picker. It also has range date picker you can select multiple days in multiple months.