balbarak / bootstrap-hijri-datepicker

Bootstrap Hijri Date picker
MIT License
56 stars 53 forks source link

How i can change from hijri to gregorian and vice versa? #36

Open hassanuos opened 2 years ago

hassanuos commented 2 years ago

Based on user input I need to show different calendars. I tried the below logic but it has not worked for me. Is there any setter function that we can use to switch calendar using code snippet ?

     if(_this.val() == 1) { 

           // I need to show hijri calendar

            _dateSelctor.hijriDatePicker({
                hijri: true,
                locale: 'ar-sa',
                format: 'YYYY-DD-MM',
                useCurrent: false,
                showSwitcher: false
            });
        }else{

           // I need to show Gregorian  calendar

            _dateSelctor.hijriDatePicker({
                hijri: false,
                locale: 'ar-sa',
                format: 'YYYY-DD-MM',
                useCurrent: false,
                showSwitcher: false
            });
        }