HTMLInputElement selector, element, or JQuery object.
options.minDate?: string
The earliest date a user may select. Default is none (undefined).
options.maxDate?: string
The latest date a user may select. Default is none (undefined).
options.maxDays?: number
Maximum number of days that can be selected. Default is indefinite (undefined).
options.locale?: string
Language Code (ja, en, etc.). Default is none (undefined).
options.format?: string
Date Format. Default is 'YYYY/M/D'.
options.language?: Record<string, string>
Strings used in the user interface.
applyLabel?: string
Apply button text. Default is 'Apply'.
cancelLabel?: string
Cancel button text. Default is 'Cancel'.
options.autoUpdateInput?: boolean
Indicates whether the date range picker should automatically update the value of the <input> element it's attached to at initialization and when the selected dates change. Default is true.
Return:
daterangepicker daterangepicker instance.
Basic
Basic example of Date Range Picker attached to an input element.
import {components} from 'metronic-extension';
// No initial value Initialize date range picker.
const dateRangePicker = components.initDatepicker(document.getElementById('noInitialValueDateRangePicker'), {
// If the "autoUpdateInput" option is set to false, the initial input value will be empty.
autoUpdateInput: false,
});