A lightweight and powerful date / time picker component.
Make sure to link to Flatpickr css and js files in your document: assets/vendor/flatpickr/dist/flatpickr.min.css and assets/vendor/flatpickr/dist/flatpickr.min.js. Use this page as a reference.
For date range feature you also need to add assets/vendor/flatpickr/dist/plugins/rangePlugin.js.
data-datepicker-options = '{}'
:
<!-- Date picker -->
<label class="form-label">Choose date</label>
<div class="position-relative">
<input class="form-control date-picker pe-5" type="text" placeholder="Choose date" data-datepicker-options='{"altInput": true, "altFormat": "F j, Y", "dateFormat": "Y-m-d"}'>
<i class="ai-calendar position-absolute top-50 end-0 translate-middle-y me-3"></i>
</div>
// Date picker
label.form-label
| Choose date
.position-relative
input(type="text", placeholder="Choose date", data-datepicker-options='{"altInput": true, "altFormat": "F j, Y", "dateFormat": "Y-m-d"}').form-control.date-picker.pe-5
i.ai-calendar.position-absolute.top-50.end-0.translate-middle-y.me-3
<!-- Date and time picker -->
<label class="form-label">Choose date and time</label>
<div class="position-relative">
<input class="form-control date-picker pe-5" type="text" placeholder="Choose date and time" data-datepicker-options='{"enableTime": true, "altInput": true, "altFormat": "F j, Y H:i", "dateFormat": "Y-m-d H:i"}'>
<i class="ai-calendar position-absolute top-50 end-0 translate-middle-y me-3"></i>
</div>
// Date and time picker
label.form-label
| Choose date and time
.position-relative
input(type="text", placeholder="Choose date and time", data-datepicker-options='{"enableTime": true, "altInput": true, "altFormat": "F j, Y H:i", "dateFormat": "Y-m-d H:i"}').form-control.date-picker.pe-5
i.ai-calendar.position-absolute.top-50.end-0.translate-middle-y.me-3
<!-- Min date + default date - Today -->
<label class="form-label">Min date - Today</label>
<div class="position-relative">
<input class="form-control date-picker pe-5" type="text" placeholder="Choose date and time" data-datepicker-options='{"altInput": true, "altFormat": "F j, Y", "dateFormat": "Y-m-d", "defaultDate": "today", "minDate": "today"}'>
<i class="ai-calendar position-absolute top-50 end-0 translate-middle-y me-3"></i>
</div>
// Min date + default date - Today
label.form-label Min date - Today
.position-relative
input(type="text", placeholder="Choose date and time", data-datepicker-options='{"altInput": true, "altFormat": "F j, Y", "dateFormat": "Y-m-d", "defaultDate": "today", "minDate": "today"}').form-control.date-picker.pe-5
i.ai-calendar.position-absolute.top-50.end-0.translate-middle-y.me-3
<!-- Date range -->
<label>Date range</label>
<div class="input-group">
<span class="input-group-text">
<i class="ai-calendar"></i>
</span>
<input class="form-control date-picker date-range" type="text" placeholder="From date" data-datepicker-options='{"altInput": true, "altFormat": "F j, Y", "dateFormat": "Y-m-d"}' data-linked-input="#end-date">
<span class="border-end border-input"></span>
<input class="form-control date-picker" type="text" placeholder="To date" data-datepicker-options='{"altInput": true, "altFormat": "F j, Y", "dateFormat": "Y-m-d"}' id="end-date">
</div>
// Date range
label Date range
.input-group
span.input-group-text
i.ai-calendar
input(type="text", placeholder="From date", data-datepicker-options='{"altInput": true, "altFormat": "F j, Y", "dateFormat": "Y-m-d"}', data-linked-input="#end-date").form-control.date-picker.date-range
span.border-end.border-input
input(type="text", placeholder="To date", data-datepicker-options='{"altInput": true, "altFormat": "F j, Y", "dateFormat": "Y-m-d"}')#end-date.form-control.date-picker