<script src="https://cdn.jsdelivr.net/gh/abublihi/datepicker-hijri@v1.1/build/datepicker-hijri.js"></script>
build
directorydatepicker-hijri.js
file like in the code below<script src="https://github.com/abublihi/datepicker-hijri/raw/master/build/datepicker-hijri.js"></script>
name | required | description |
---|---|---|
reference | yes | an identifier for the element where the datepicker will appear it must be an id for an html element |
placement | no | the placement of the the datepicker 'bottom', 'top', 'right', 'left' and 'auto' default: bottom, you can use any placement in popper.js |
date-format | no | the date format, it is string, default: iYYYY/iMM/iDD, any format in moment-hijri will work |
selected-date | no | the selected date it is string with the same format of date-format prop |
on-date-select-close | no | if you want the datepicker to disapeare on chosing the date only add on-date-select-close |
In the Example below the input
with id calender is the reference for the datepicker-hijri web component, so if you click or focus on the input the datepicker will be shown.
<input type="text" id="calender">
<datepicker-hijri reference="calender" placement="bottom" date-format="iYYYY/iMM/iDD" selected-date="1441/02/01"></datepicker-hijri>
onchange
in any change on the date, will be firing a change
event. so you can listen and respond to the change.
<input type="text" id="calender" onchange="console.log('changed')">
<!-- ^^^^^^^^ -->
<datepicker-hijri reference="calender" placement="bottom" date-format="iYYYY/iMM/iDD" selected-date="1441/02/01"></datepicker-hijri>
So the datepicker shown and every thing is good, but what is happening, when the user chooses the day, the datepicker will modify the attribute value
on the reference with the new value.