Flatpickr lightweight and powerful datetime picke

Overview

Lean, UX-driven, and extensible, yet it doesn’t depend on any libraries. There’s minimal UI but many themes. Rich, exposed APIs and event system make it suitable for any environment. For full documentation please check the plugin's site.

Usage

Flatpickr's CSS and Javascript files are bundled in the global plugin bundles and globally included in all pages:
<link href="assets/plugins/global/plugins.bundle.css" rel="stylesheet" type="text/css"/>
<script src="assets/plugins/global/plugins.bundle.js"></script>

Initialization

  • Flatpickr's CSS is highly customized in sass/vendors/plugins/_flatpickr.scssSCSS file in order to use it as native component within the design system. The SCSS code is compiled into assets/plugins/global/plugins.bundle.cssand globally included in all pages.
  • Flatpickr's Javascript is globally initialized with some predefined settings in src/js/vendors/plugins/flatpickr.init.jsand the initialization code is bundled within assets/plugins/global/plugins.bundle.jsand globally included in all pages.
  • To start usin Flatpckr right away, check the official Getting Started guide.

Basic Examples

Basic examples of Flatpickr on default and solid background input styles:
$("#kt_datepicker_1").flatpickr();

$("#kt_datepicker_2").flatpickr();
<div class="mb-10">
    <label for="" class="form-label">Default input style</label>
    <input class="form-control" placeholder="Pick a date" id="kt_datepicker_1"/>
</div>

<div class="mb-0">
    <label for="" class="form-label">Solid background style</label>
    <input class="form-control form-control-solid" placeholder="Pick a date" id="kt_datepicker_2"/>
</div>

DateTime

Specify datetime format through dateFormatparameter to enable date and time selection.
$("#kt_datepicker_3").flatpickr({
    enableTime: true,
    dateFormat: "Y-m-d H:i",
});
<div class="mb-0">
    <label for="" class="form-label">Select date and time</label>
    <input class="form-control form-control-solid" placeholder="Pick date & time" id="kt_datepicker_3"/>
</div>

Disabling Dates

Use disableoption to make certain dates or range of dates unavailable for selection:
$("#kt_datepicker_4").flatpickr({
    onReady: function () {
        this.jumpToDate("2025-01")
    },
    disable: ["2025-01-10", "22025-01-11", "2025-01-12", "2025-01-13", "2025-01-14", "2025-01-15", "2025-01-16", "2025-01-17"],
    dateFormat: "Y-m-d",
});

$("#kt_datepicker_5").flatpickr({
    onReady: function () {
        this.jumpToDate("2025-01")
    },
    dateFormat: "Y-m-d",
    disable: [
        {
            from: "2025-01-05",
            to: "2025-01-25"
        },
        {
            from: "2025-02-03",
            to: "2025-02-15"
        }
    ]
});

Selecting Multiple Dates

It is possible to select multiple dates at once:
$("#kt_datepicker_6").flatpickr({
    onReady: function () {
        this.jumpToDate("2025-01")
    },
    mode: "multiple",
    dateFormat: "Y-m-d",
    defaultDate: ["2025-01-05", "2025-01-10"]
});

Range Selections

Select a range of dates using the range calendar. Note that disabled dates (by either minDate, maxDate, enable or disable) will not be allowed in selections.
$("#kt_datepicker_7").flatpickr({
    altInput: true,
    altFormat: "F j, Y",
    dateFormat: "Y-m-d",
    mode: "range"
});

Time Picker

Hide date picker and allow only time picker:
$("#kt_datepicker_8").flatpickr({
    enableTime: true,
    noCalendar: true,
    dateFormat: "H:i",
});

Week Numbers

Enable the weekNumbers option to display the week number in a column left to the calendar.
$("#kt_datepicker_9").flatpickr({
    weekNumbers: true
});

Modal Example

Use Flatpickr within Bootstrap Modal:
$("#kt_datepicker_10").flatpickr();
<!--begin::Modal-->
<div class="modal fade" tabindex="-1" id="kt_modal_1">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <h5 class="modal-title">Modal title</h5>

                <!--begin::Close-->
                <div class="btn btn-icon btn-sm btn-active-light-primary ms-2" data-bs-dismiss="modal" aria-label="Close">
                    <span class="svg-icon svg-icon-2x"></span>
                </div>
                <!--end::Close-->
            </div>

            <div class="modal-body">
                <div class="mb-0">
                    <label for="" class="form-label">Select date</label>
                    <input class="form-control form-control-solid" placeholder="Pick date" id="kt_datepicker_10"/>
                </div>
            </div>

            <div class="modal-footer">
                <button type="button" class="btn btn-light" data-bs-dismiss="modal">Close</button>
                <button type="button" class="btn btn-primary">Save changes</button>
            </div>
        </div>
    </div>
</div>
<!--end::Modal-->

Activity Logs

There are 2 new tasks for you in “AirPlus Mobile APp” project:
Added at 4:23 PM by
img
Meeting with customer
Application Design
img
img
A
In Progress
View
Project Delivery Preparation
CRM System Development
img
B
Completed
View
Invitation for crafting engaging designs that speak human workshop
Sent at 4:23 PM by
img
Task #45890merged with #45890in “Ads Pro Admin Dashboard project:
Initiated at 4:23 PM by
img
3 new application design concepts added:
Created at 4:23 PM by
img
New case #67890is assigned to you in Multi-platform Database Design project
Added at 4:23 PM by
Alice Tan
You have received a new order:
Placed at 5:05 AM by
img

Database Backup Process Completed!

Login into Jet Admin Dashboard to make sure the data integrity is OK
Proceed
New order #67890is placed for Workshow Planning & Budget Estimation
Placed at 4:23 PM by
Jimmy Bold
Upgrade To Pro
Pro Version Benefits Free Pro
UI Elements 20 100
In-house Components 20 40
Crafted Pages 5 20
Complete Documentation
Product Support
Layout Builder
Email Templates
Chat App
Customers App
Upgrade to Jet HTML Pro