# Documentation v8.0.38

Preview Downloads Purchase

# Overview

Date Range Picker can be attached to any webpage element to pop up two calendars for selecting dates, times, or predefined ranges like "Last 30 Days". For full documentation please check the plugin's site.

# Usage

Date Range Picker'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

- Date Range Picker's CSS is highly customized in `sass/vendors/plugins/_daterangepicker.scss`SCSS file in order to use it as native component within the design system. The SCSS code is compiled into `assets/plugins/global/plugins.bundle.css`and globally included in all pages.
- Date Range Picker's Javascript is bundled with `assets/plugins/global/plugins.bundle.js`and globally included in all pages.

# Basic Examples

Basic example of Date Range Picker attached to an input element:
Example

    $("#kt_daterangepicker_1").daterangepicker();

    <div class="mb-0">
        <label class="form-label">Basic example</label>
        <input class="form-control form-control-solid" placeholder="Pick date rage" id="kt_daterangepicker_1"/>
    </div>

# With Times

Enable date selection with times:
Example

    $("#kt_daterangepicker_2").daterangepicker({
        timePicker: true,
        startDate: moment().startOf("hour"),
        endDate: moment().startOf("hour").add(32, "hour"),
        locale: {
            format: "M/DD hh:mm A"
        }
    });

    <div class="mb-0">
        <label class="form-label">Example</label>
        <input class="form-control form-control-solid" placeholder="Pick date rage" id="kt_daterangepicker_2"/>
    </div>

# Single Date Picker

Use Date Range Picker as single date picker:
Example

    $("#kt_daterangepicker_3").daterangepicker({
            singleDatePicker: true,
            showDropdowns: true,
            minYear: 1901,
            maxYear: parseInt(moment().format("YYYY"),10)
        }, function(start, end, label) {
            var years = moment().diff(start, "years");
            alert("You are " + years + " years old!");
        }
    );

    <div class="mb-0">
        <label class="form-label">Example</label>
        <input class="form-control form-control-solid" placeholder="Pick date rage" id="kt_daterangepicker_3"/>
    </div>

# Predefined Date Ranges

Enable date range selection from predefined options:
Example

    var start = moment().subtract(29, "days");
    var end = moment();

    function cb(start, end) {
        $("#kt_daterangepicker_4").html(start.format("MMMM D, YYYY") + " - " + end.format("MMMM D, YYYY"));
    }

    $("#kt_daterangepicker_4").daterangepicker({
        startDate: start,
        endDate: end,
        ranges: {
        "Today": [moment(), moment()],
        "Yesterday": [moment().subtract(1, "days"), moment().subtract(1, "days")],
        "Last 7 Days": [moment().subtract(6, "days"), moment()],
        "Last 30 Days": [moment().subtract(29, "days"), moment()],
        "This Month": [moment().startOf("month"), moment().endOf("month")],
        "Last Month": [moment().subtract(1, "month").startOf("month"), moment().subtract(1, "month").endOf("month")]
        }
    }, cb);

    cb(start, end);

    <input class="form-control form-control-solid" placeholder="Pick date rage" id="kt_daterangepicker_4"/>

# Modal Example

Use Date Range Picker within Bootstrap Modal:

##### Modal title

Example

    $("#kt_daterangepicker_5").daterangepicker();

    <!--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-->

### Explore

### Metronic Licenses

License FAQs
Regular License
For single end product used by you or one client
$ 39
Extended License
For single SaaS app with paying users
$ 969
Custom License
Reach us for custom license offers.
Contact Us
Buy Now

### Metronic Demos

Demo 1
Demo 2
Demo 3
Demo 4
Demo 5
Demo 6
Demo 7
Demo 8
Demo 9
Demo 10
Demo 11
Demo 12
Demo 13
Demo 14
Demo 15
Demo 16
Demo 17
Demo 18
Demo 19
Demo 20
Demo 21
Demo 22
Coming soon
Coming soon

##### Learn & Get Inspired

## Support at devs.keenthemes.com

Join our developers community to find answer to your question and help others. FAQs
Get Support
Documentation & Videos
From guides and video tutorials, to live demos and code examples to get started.
Plugins & Components
Check out our 300+ in-house components and customized 3rd-party plugins.
Layout Builder
Build your layout, preview it and export the HTML for server side integration.
Metronic Downloads
Download your prefered framework and demo with one click.
What's New
Latest features and improvements added with our users feedback in mind.
Buy now