Datepicker (Flatpickr)
Flatpickr is a lightweight and powerful datetime picker.
Flatpickr documentationHow to use
Copy-paste the stylesheet <link>
into your <head>
to load the CSS.
<link rel="stylesheet" href="../node_modules/flatpickr/dist/flatpickr.min.css">
Copy-paste the following <script>
near the end of your pages under JS Implementing Plugins to enable it.
<script src="../node_modules/flatpickr/dist/flatpickr.min.js"></script>
Copy-paste the following <script>
near the end of your pages under JS Front to enable it.
<script src="../assets/js/hs.flatpickr.js"></script>
Copy-paste the init function under JS Plugins Init., before the closing </body>
tag, to enable it.
<script>
$(document).on('ready', function () {
// initialization of flatpickr
$('.js-flatpickr').each(function () {
$.HSCore.components.HSFlatpickr.init($(this));
});
});
</script>
Custom file input
With value
Use value
attribute.
External elements
Range dates
Use range
dates.
Multiple dates
Use multiple
mode.
Plain Text
Use "inline": true
Disabling dates
Your can write custom javascript function.
Modal example
Your can write custom javascript function.
Methods
Parameters | Description | Default value |
---|---|---|
mode |
Mode of flatpickr. | single |
dateFormat |
Date format. | d M Y |
maxDate |
The maximum date that a user can pick to (inclusive). | false |
locale.firstDayOfWeek |
Day number. | 1 |
locale.weekdays.shorthand |
Short day names. | ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"] |
locale.rangeSeparator |
Range separator in the field. | - |
nextArrow |
Next arrow template. | <i class="la la-angle-right icon-text icon-text-sm"></i> |
prevArrow |
Previous arrow template. | <i class="la la-angle-left icon-text icon-text-sm"></i> |