Date range picker - lightweight
- jQuery
- Jalali moment
To start this project, you only need to do one step.
Download daterangepicker and include it in your project with jQuery and Jalali Moment.
<link rel="stylesheet" type="text/css" href="dateragepicker.css" />
<script type="text/javascript" src="jquery.js"></script>
<script src="jalali-moment.js"></script>
<script src="dateragepicker.js"></script>
const Jmoment = moment().locale('fa');
$('#daterangepicker').daterangepicker({
autoApply: true,
alwaysShowCalendars: true,
minDate: new Date(),
persian: {
enable: true,
persianDigits: true,
},
locale: {
direction: 'rtl',
firstDay: 0,
format: 'jYYYY-jMM-jDD',
applyLabel: 'اعمال',
cancelLabel: 'لغو',
monthNames: [
"فروردین",
"اردیبهشت",
"خرداد",
"تیر",
"مرداد",
"شهریور",
"مهر",
"آبان",
"آذر",
"دی",
"بهمن",
"اسفند"
],
daysOfWeek: [
'ش',
'ی',
'د',
'س',
'چ',
'پ',
'ج',
],
}
});
To create a Persian date range picker, you can use the "settings" object as follows:
persian: {
enable: true,
persianDigits: true,
},
In this object, the two properties serve the following purposes: enable: Used to enable the Persian localization feature. persianDigits: Used to convert English digits to Persian.
This is a modified version of https://www.daterangepicker.com/
So you can read the complete documentation at this address.
If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star! Thanks again!
Fork the Project Create your Feature Branch (git checkout -b feature/AmazingFeature) Commit your Changes (git commit -m 'Add some AmazingFeature') Push to the Branch (git push origin feature/AmazingFeature) Open a Pull Request