Options guide of datedropper jQuery

This plugin is deprecated, get the new javascript version

How to set an option

datedropper options can be set in two ways:

  • using a data attribute;
  • using Javascript when initializing datedropper.

Set an option by using a data attribute

In order to set an option by using a data attribute, add and customize the related attribute on the element on which datedropper has to be executed.

For instance, you can change the date format by simply customizing the selector as follows:

<input type="text" data-dd-format="S M., Y">

Set an option by using Javascript

You can also set an option during the initialization by customizing the related .dateDropper() function variable.

$('.roundtrip-input').dateDropper({
  format: 'Y-m-d'
});

Options and default values

datedropper provides you with several options to customize your date pickers.


Basic options


format

Data attributedata-dd-format
.dateDropper() variableformat

Use the format option to customize the format of the date returned by datedropper.

FEATURES

Typestring
Defaultm/d/Y

PERMITTED VALUES

Yfour digit year value, e.g. 2019
Ffull name of the month, e.g. January
Mshort name of the month, e.g. Jan
lfull name of the weekday, e.g. Monday
Dshort name of the weekday, e.g. Mon
mmonth in numbers with leading zero, e.g. 01
nmonth in numbers without leading zero, e.g. 1
dweekday in numbers with leading zero, e.g. 01
jweekday in numbers without leading zero, e.g. 1
Sweekday in numbers with a suffix ending, e.g. 1st
UUnix timestamp, e.g. 1577750400

EXAMPLES

Sample configuration with data attribute

<input type="text" data-dd-format="d-m-Y">

Sample configuration with Javascript

$('#my-input').dateDropper({
  format: 'd-m-Y'
});

lang

Data attributedata-dd-lang
.dateDropper() variablelang

Use the lang option to set the language of your date picker.

FEATURES

Typestring
Defaulten

AVAILABLE LANGUAGES

ar(Arabic)
da(Danish)
de(German)
es(Spanish)
fr(French)
gr(Greek)
hu(Hungarian)
it(Italian)
ko(Korean)
nl(Dutch)
pl(Polish)
pt(Portuguese)
ru(Russian)
si(Slovenian)
tr(Turkish)
uk(Ukrainian)

EXAMPLES

Sample configuration with data attribute

<input type="text" data-dd-lang="es">

Sample configuration with Javascript

$('#my-input').dateDropper({
  lang: 'es'
});

Styling options


theme

Data attributedata-dd-theme
.dateDropper() variabletheme

Use the theme option to set the datedropper theme. Learn more on all the available themes and on how to create your own style.

FEATURES

Typestring
Defaultvanilla

EXAMPLES

Sample configuration with data attribute

<input type="text" data-dd-theme="leaf">

Sample configuration with Javascript

$('#my-input').dateDropper({
  theme: 'leaf'
});

fx and fxMobile

Data attributedata-dd-fxdata-dd-fx-mobile
.dateDropper() variablefxfxMobile

Use the fx and the fxMobile options to enable or disable any animations/transitions. fxMobile option only affects mobile devices.

FEATURES

Typeboolean
Defaulttrue

EXAMPLES

Sample configuration with data attribute

<input type="text" data-dd-fx="true" data-dd-fx-mobile="false">

Sample configuration with Javascript

$('#my-input').dateDropper({
  fx: true,
  fxMobile: false
});

Data attributedata-dd-modal
.dateDropper() variablemodal

Set the modal option as true in order to open the date picker as a modal window with an overlay on the background.

FEATURES

Typeboolean
Defaultfalse

EXAMPLES

Sample configuration with data attribute

<input type="text" data-dd-modal="true">

Sample configuration with Javascript

$('#my-input').dateDropper({
  modal: true
});

large

Data attributedata-dd-large
.dateDropper() variablelarge

Set the large option as true to enable a button that opens the date picker as a calendar.

FEATURES

Typeboolean
Defaultfalse

EXAMPLES

Sample configuration with data attribute

<input type="text" data-dd-large="true">

Sample configuration with Javascript

$('#my-input').dateDropper({
  large: true
});

largeDefault

Data attributedata-dd-large-default
.dateDropper() variablelargeDefault

Set the largeDefault option as true to open the date picker as a calendar by default.

FEATURES

Typeboolean
Defaultfalse

EXAMPLES

Sample configuration with data attribute

<input type="text" data-dd-large-default="true">

Sample configuration with Javascript

$('#my-input').dateDropper({
  largeDefault: true
});

largeOnly

Data attributedata-dd-large-only
.dateDropper() variablelargeOnly

Set the largeOnly option as true to only open the date picker as a calendar.

FEATURES

Typeboolean
Defaultfalse

EXAMPLES

Sample configuration with data attribute

<input type="text" data-dd-large-only="true">

Sample configuration with Javascript

$('#my-input').dateDropper({
  largeOnly: true
});

hideDay, hideMonth and hideYear

Data attributedata-dd-hide-daydata-dd-hide-monthdata-dd-hide-year
.dateDropper() variablehideDayhideMonthhideYear

Set these options as true to hide the day, the month and/or the year block from the date picker.

FEATURES

Typeboolean
Defaultfalse

EXAMPLES

Sample configuration with data attribute

<input type="text" data-dd-hide-day="true" data-dd-hide-month="true" data-hide-year="false">

Sample configuration with Javascript

$('#my-input').dateDropper({
  hideDay: true,
  hideMonth: true,
  hideYear: false
});

Customizing dates and any other features


maxYear and minYear

Data attributedata-dd-max-yeardata-dd-min-year
.dateDropper() variablemaxYearminYear

Use the maxYear and minYear options to set the maximum and minimum selectable years.

The selected year must be provided in the format yyyy (e.g. '2019').

FEATURES

maxYear

Typeinteger
DefaultcurrentYear

minYear

Typeinteger
Default1970

EXAMPLES

Sample configuration with data attribute

<input type="text" data-dd-max-year="2050" data-dd-min-year="2000">

Sample configuration with Javascript

$('#my-input').dateDropper({
  maxYear: 2050,
  minYear: 2000
});

jump

Data attributedata-dd-jump
.dateDropper() variablejump

If the jump option is set as true, by clicking on the years block the user will be allowed to move through the years between minYear and maxYear in multiples of the value defined with the jump option.

FEATURES

Typeinteger/false
Default10

EXAMPLES

Sample configuration with data attribute

<input type="text" data-dd-jump="5">

Sample configuration with Javascript

$('#my-input').dateDropper({
  jump: 5
});

lock

Data attributedata-dd-lock
.dateDropper() variablelock

Set the lock option as equal to from or to if you want to make the dates selectable from or up to the current date.

FEATURES

Typestring/false
Defaultfalse

EXAMPLES

Sample configuration with data attribute

<input type="text" data-dd-lock="from">

Sample configuration with Javascript

$('#my-input').dateDropper({
  lock: 'from'
});

startFromMonday

Data attributedata-dd-start-from-monday
.dateDropper() variablestartFromMonday

Set the startFromMonday option as false to start the week from Sunday.

FEATURES

Typeboolean
Defaulttrue

EXAMPLES

Sample configuration with data attribute

<input type="text" data-dd-start-from-monday="false">

Sample configuration with Javascript

$('#my-input').dateDropper({
  startFromMonday: false
});

defaultDate

Data attributedata-dd-default-date
.dateDropper() variabledefaultDate

Use the defaultDate option to select the default date set when opening the date picker. Keep in mind that the default date must be provided in the format mm/dd/yyyy (e.g. '12/31/2019').

FEATURES

Typestring/object/null
Defaultnull

EXAMPLES

Sample configuration with data attribute

<input type="text" data-dd-default-date="12/31/2019">

Sample configuration with Javascript

$('#my-input').dateDropper({
  defaultDate: '12/31/2019'
});

maxDate and minDate

Data attributedata-dd-max-datedata-dd-min-date
.dateDropper() variablemaxDateminDate

Use the maxDate and the minDate options if you want to make the dates selectable until or from the defined date.

The date must be provided in the format mm/dd/yyyy (e.g. '12/31/2019').

FEATURES

Typestring/false
Defaultfalse

EXAMPLES

Sample configuration with data attribute

<input type="text" data-dd-max-date="12/31/2019">

Sample configuration with Javascript

$('#my-input').dateDropper({
  minDate: '12/31/2019'
});

disabledDays

Data attributedata-dd-disabled-days
.dateDropper() variabledisabledDays

When enabled, the disabledDays option allows you to disable one or more dates. Dates must be provided in the format mm/dd/yyyy, comma separated (e.g. '12/30/2019,12/31/2019').

FEATURES

Typestring/false
Defaultfalse

EXAMPLES

Sample configuration with data attribute

<input type="text" data-dd-disabled-days="12/30/2019,12/31/2019">

Sample configuration with Javascript

$('#my-input').dateDropper({
  disabledDays: '12/30/2019,12/31/2019'
});

enabledDays

Data attributedata-dd-enabled-days
.dateDropper() variableenabledDays

When enabled, the enabledDays option allows you to only enable the selected dates. Dates must be provided in the format mm/dd/yyyy, comma separated (e.g. '12/30/2019,12/31/2019').

FEATURES

Typestring/false
Defaultfalse

EXAMPLES

Sample configuration with data attribute

<input type="text" data-dd-enabled-days="12/30/2019,12/31/2019">

Sample configuration with Javascript

$('#my-input').dateDropper({
  enabledDays: '12/30/2019,12/31/2019'
});

showOnlyEnabledDays

Data attributedata-dd-show-only-enabled-days
.dateDropper() variableshowOnlyEnabledDays

The showOnlyEnabledDays option only works when the enabledDays option is defined and, if set as true, it shows only the available dates by using the date picker compact version. Therefore, this option overwrites the largelargeDefault and largeOnly options.

FEATURES

Typeboolean
Defaultfalse

EXAMPLES

Sample configuration with data attribute

<input type="text" data-dd-enabled-days="12/30/2019,12/31/2019" data-dd-show-only-enabled-days="true">

Sample configuration with Javascript

$('#my-input').dateDropper({
  enabledDays: '12/30/2019,12/31/2019',
  showOnlyEnabledDays: true
});

roundtrip

Data attributedata-dd-roundtrip
.dateDropper() variableroundtrip

The roundtrip option can be set up on one or two elements by defining a custom value (e.g. data-dd-roundtrip="trip"). If you set it on two elements, use the same value for both the elements. When enabled, this option allows the user to select outward and return dates from the same date picker.

FEATURES

Typestring/false
Defaultfalse

EXAMPLES

Sample configuration with data attribute

<input id="outward-date" type="text" data-dd-roundtrip="my-trip">
<input id="return-date" type="text" data-dd-roundtrip="my-trip">

Sample configuration with Javascript

$('input').dateDropper({
  roundtrip: 'my-trip'
});

autoIncrease

Data attributedata-dd-auto-increase
.dateDropper() variableautoIncrease

By default, when the user clicks on the date picker arrows to advance by one day, and it's the last day of the month or year, datedropper will automatically jump to the next month or year. Set the autoIncrease option as false to disable this behavior.

FEATURES

Typeboolean
Defaulttrue

EXAMPLES

Sample configuration with data attribute

<input type="text" data-dd-auto-increase="false">

Sample configuration with Javascript

$('#my-input').dateDropper({
  autoIncrease: false
});

Advanced options


changeValueTo

Data attributedata-dd-change-value-to
.dateDropper() variablechangeValueTo

Use the changeValueTo option to define a selector to which datedropper should pass the value set on the date picker. Keep in mind that this selector must be an input.

FEATURES

Typestring
Defaultnull

EXAMPLES

Sample configuration with data attribute

<button class="datedropper-init" data-dd-change-value-to="#my-input">Open datepicker</button>
<input id="my-input"/>

Sample configuration with Javascript

$('button').dateDropper({
  changeValueTo: '#my-input'
});

eventListener

Data attributedata-dd-event-listener
.dateDropper() variableeventListener

Use the eventListener option to define the event through which the selector should activate datedropper. By default, the date picker is enabled on focus.

FEATURES

Typestring
Defaultfocus

EXAMPLES

Sample configuration with data attribute

<input type="text" data-dd-event-selector="click">

Sample configuration with Javascript

$('#my-input').dateDropper({
  eventSelector: 'click'
});

trigger

Data attributedata-dd-trigger
.dateDropper() variabletrigger

A click on the trigger selector activates the eventListener of the datedropper element.

FEATURES

Typestring/false
Defaultfalse

EXAMPLES

Sample configuration with data attribute

<input type="text" data-dd-trigger="#my-trigger">

Sample configuration with Javascript

$('#my-input').dateDropper({
  trigger: '.my-trigger'
});

autofill

Data attributedata-dd-autofill
.dateDropper() variableautofill

By default, datedropper automatically fills out the selector with the selected date whenever it moves or gets initialized. Set the autofill option as false to disable this behavior.

FEATURES

Typeboolean
Defaulttrue

EXAMPLES

Sample configuration with data attribute

<input type="text" data-dd-autofill="false">

Sample configuration with Javascript

$('#my-input').dateDropper({
  autofill: false
});


loopAll

Data attributedata-dd-loop-all
.dateDropper() variableloopAll

If false, it locks navigation and hides arrows of the current selector (day, month, year) when the minimum or maximum value is reached.

FEATURES

Typeboolean
Defaulttrue

EXAMPLES

Sample configuration with data attribute

<input type="text" data-dd-loop-all="false">

Sample configuration with Javascript

$('#my-input').dateDropper({
  loopAll: false
});

loopYears

Data attributedata-dd-loop-years
.dateDropper() variableloopYears

If false, it locks navigation and hides arrows of the year selector when the minimum or maximum year is reached.

FEATURES

Typeboolean
Defaulttrue

EXAMPLES

Sample configuration with data attribute

<input type="text" data-dd-loop-years="false">

Sample configuration with Javascript

$('#my-input').dateDropper({
  loopYears: false
});

loopMonths

Data attributedata-dd-loop-months
.dateDropper() variableloopMonths

If false, it locks navigation and hides arrows of the month selector when the minimum or maximum month is reached.

FEATURES

Typeboolean
Defaulttrue

EXAMPLES

Sample configuration with data attribute

<input type="text" data-dd-loop-months="false">

Sample configuration with Javascript

$('#my-input').dateDropper({
  loopMonths: false
});

loopDays

Data attributedata-dd-loop-days
.dateDropper() variableloopDays

If false, it locks navigation and hides arrows of the day selector when the minimum or maximum day is reached.

FEATURES

Typeboolean
Defaulttrue

EXAMPLES

Sample configuration with data attribute

<input type="text" data-dd-loop-days="false">

Sample configuration with Javascript

$('#my-input').dateDropper({
  loopDays: false
});