Skip to content

m-younis/bootstrap-hijri-datepicker

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Getting Started

Bootstrap Hijri Date picker v0.1.0

sample sample two

Installation

Use css and javascript files in dist folder

Required libraries

Usage

includes

css

<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.3.1/css/bootstrap.min.css" />

<link href="css/bootstrap-datetimepicker.min.css" rel="stylesheet" />

js

<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
    
<script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.22.1/moment.min.js"></script>

<script src="js/bootstrap-hijri-datepicker.min.js"></script>

html

 <div class="form-group">
    <label>
        Date
    </label>
    <div class="input-group">
        <input type='text' class="form-control" id="hijri-date-input" />
    </div>
</div>

javascript

<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.22.1/moment.min.js"></script>
<script src="js/bootstrap-hijri-datepicker.min.js"></script>
    
<script type="text/javascript">
    $(function () {
        $("#hijri-date-input").hijriDatePicker();
    });
</script>

Complete Sample

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8" />
    <title>
        Bootstrap Hijri Date Picker
    </title>
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.3.1/css/bootstrap.min.css" />
    <link href="css/bootstrap-datetimepicker.min.css" rel="stylesheet" />

</head>
<body class="bg-light">
    <div class="container">

        <div class="form-group">
            <label>
                Date
            </label>
            <div class="input-group">
                <input type='text' class="form-control" id="hijri-date-input" />
            </div>
        </div>
    </div>

    <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.22.1/moment.min.js"></script>
    <script src="js/bootstrap-hijri-datepicker.min.js"></script>
    <script type="text/javascript">

        $(function () {

            $("#hijri-date-input").hijriDatePicker();

        });

    </script>

</body>
</html>

Options

to use options simple pass options object see below

$("#hijri-date-input").hijriDatePicker(
    {
        hijri : true,
        format: "DD-MM-YYYY",
        hijriFormat: 'iYYYY-iMM-iDD',
    });
  • hijri : boolean

    set hijri date as default

  • format: string

    to set gregorian momentjs format

  • hijriFormat: string

    hijri format should start with i for example iYYYY

  • dayViewHeaderFormat: string

    picker header for gregorian dates ex: MM-YYYY

  • hijriDayViewHeaderFormat: string

    picker header for hijri dates ex: iMMM-iYYYY

  • showSwitcher: boolean

    to display switch button from hijri to gregorian defautl true

  • showTodayButton: boolean

    to display today button

  • showClear: boolean

    to display clear button

  • showClose: boolean

    to display close button

  • viewDate: string

    to set the default view gregorian date in the picker ex: 1980-01-01

RTL support

To enable rtl simply include bootstrap rtl from https://bootstrap.rtlcss.com/ and set <html dir="rtl">

ex:

<html dir="rtl">
<head>
   
    <meta charset="utf-8" />
   
   <link rel="stylesheet" href="https://cdn.rtlcss.com/bootstrap/v4.2.1/css/bootstrap.min.css">

    <link href="css/bootstrap-datetimepicker.min.css" rel="stylesheet" />
</head>
....

Acknowledgements

This project was built from great work done by

License

MIT

About

Bootstrap Hijri Date picker

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • CSS 57.6%
  • JavaScript 42.2%
  • HTML 0.2%