Skip to content

damavandon/persian-daterangepicker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Persian Date Range Picker

Persian Date Picker

Range Picker

N|Solid

Build Status

Single Date Picker

Build Status

Introduction

Date range picker - lightweight

Built With

  • jQuery
  • Jalali moment

Getting Started

To start this project, you only need to do one step.

Prerequisites

Download daterangepicker and include it in your project with jQuery and Jalali Moment.

Installation

<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>

Usage

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.

Contributing

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