Use the function chi.datepicker(elem)
to instantiate a new date picker component in the input of type
text element passed as a parameter. This component uses the
Day.js library.
Input of type text should be used and any other type, including type date, will be converted into type text.
<div class="m-input__wrapper -icon--right">
<input id='#datepicker-1' type="text" class="a-input" placeholder="MM/DD/YYYY" value="">
<div class="a-icon -text--muted">
<svg>
<use xlink:href="#icon-date"></use>
</svg>
</div>
</div>
<script>chi.datePicker(document.getElementById('datepicker-1'));</script>
<div class="m-input__wrapper -icon--right">
<input value="01/24/2019" min="01/14/2019" max="02/07/2019" id='#datepicker-2' type="text" class="a-input" placeholder="MM/DD/YYYY">
<div class="a-icon -text--muted">
<svg>
<use xlink:href="#icon-date"></use>
</svg>
</div>
</div>
<script>chi.datePicker(document.getElementById('datepicker-2'));</script>
This component accepts options to configure its behavior.
<div class="m-input__wrapper -icon--right">
<input id='#datepicker-3' type="text" class="a-input" placeholder="MM/DD/YYYY" value="">
<div class="a-icon -text--muted">
<svg>
<use xlink:href="#icon-date"></use>
</svg>
</div>
</div>
<script>
chi.datePicker(
document.getElementById('datepicker-3'),
{
date: '01/24/2019',
min: '01/24/2019'
}
);
</script>