Datepicker
Use Datepicker plugin to enable input for picking dates
Getting started
You need to include the following javascript file before the end of the body
tag:
<script src="@@path/vendor/vanillajs-datepicker/dist/js/datepicker.min.js"></script>
Datepicker
Use the following markup to create a single datepicker:
<label for="birthday">Birthday</label>
<div class="input-group">
<span class="input-group-text"><span class="far fa-calendar-alt"></span></span>
<input data-datepicker="" class="form-control" id="birthday" type="text" placeholder="dd/mm/yyyy" required>
</div>
Javascript
Initializing the datepicker is fairly straightforward. Here’s how we use it in volt.js
:
var datepickers = [].slice.call(document.querySelectorAll('[data-datepicker]'))
var datepickersList = datepickers.map(function (el) {
return new Datepicker(el, {
buttonClass: 'btn'
});
});
Read more about Vanilla JS Datepicker from the documentation.