0.0.10 • Published 3 months ago

hijri-datepicker-component v0.0.10

Weekly downloads
-
License
MIT
Repository
github
Last release
3 months ago

Built With Stencil

Forked and enhanced version of datepicker-hijri with additional features.

Hijridate picker web component, simple and can be integrated easily with any frameworks. (محدد التاريخ الهجري)

This package created to support my company project and been updated with a CR or Bugs created by our testers

Feel free to request or enhance the code with a PR.

Installation

Stand alone:

  • Use NPM
 npm i hijri-datepicker-component
  • Use CDN
<script src="https://cdn.jsdelivr.net/npm/hijri-datepicker-component@latest/dist/datepicker-hijri/datepicker-hijri.js"></script>
  • Download files
  1. Download all files in the build directory
  2. Include the script datepicker-hijri.js file like in the code below
<script src="build/datepicker-hijri.js"></script>

Usage

Attributes:

namerequireddescription
referenceyesan identifier for the element where the datepicker will appear it must be an id for an html element
placementnothe placement of the the datepicker 'bottom', 'top', 'right', 'left' and 'auto' default: bottom, you can use any placement in popper.js
date-formatnothe date format, it is string, default: iYYYY/iMM/iDD, any format in moment-hijri will work
selected-datenothe selected date it is string with the same format of date-format prop
placeholderno
on-date-select-closenoif you want the datepicker to disapeare on chosing the date only add
auto-set-selected-datenoif you want the datepicker to auto send initial value for today
min-datenoif you want the datepicker to set minimum date
max-datenoif you want the datepicker to set maximum date

Example

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>

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

Demo

Codepen Hijridate picker

Demo Image

how it works

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.

Credits

  • @xsoh Thank for the awesome package moment-hijir.
  • @FezVrasta Thank you for the package popper.js.
0.0.10

3 months ago

0.0.9

3 months ago

0.0.8

3 months ago

0.0.7

4 months ago

0.0.6

4 months ago

0.0.3

4 months ago

0.0.5

4 months ago

0.0.4

4 months ago

0.0.2

5 months ago

0.0.1

5 months ago