Skip to content

Options ​

Every option can be set as a data-fdp-* attribute or as a JS option in new FlowDatepicker(element, options) / FlowDatepicker.init(root, options). Attribute names are the option names in kebab case.

OptionAttributeValuesDefault
modedata-fdp-modedate, time, datetime, range or a registered modefrom the input type
triggerdata-fdp-triggerfield, pillpill for range, field otherwise
min, maxdata-fdp-min, data-fdp-maxtoday, an ISO date or a Datenone
closeOnSelectdata-fdp-close-on-selecttrue, falsetrue
calendardata-fdp-calendaralways, custom (range only)always
presetsdata-fdp-presetsJSON list, none, or a JS arrayfive defaults
monthsdata-fdp-monthsnumber of months in range modefits the space
localedata-fdp-localea language tag such as de-DEnearest lang, then the browser
weekStartdata-fdp-week-start0 (Sunday) to 6from the locale
hourCycledata-fdp-hour-cycle12, 24from the locale
weekdayLengthdata-fdp-weekday-lengthmin, short, narrow, longmin
placeholderdata-fdp-placeholderany texta format hint
labels(JS only)object, see LabelsEnglish

Native attributes ​

AttributeEffect
typepicks the mode
valuethe starting value, in ISO
min, maxlimits for days (and for the browser's own validation)
stepminute step of the time handles, in seconds; seconds part when not whole minutes
requiredbrowser validation, the field turns red when empty on submit
disabled, readonlythe picker does not open
nameposted as usual

Starting ​

AttributeEffect
data-flow-datepickerstart automatically
data-flow-datepicker="range"on a wrapper with two date inputs
data-flow-datepicker="manual"do not start automatically

Defaults for all pickers ​

js
FlowDatepicker.defaults.closeOnSelect = false;
FlowDatepicker.defaults.labels.today = 'Heute';

Change them before the pickers start (with the ES module build, before init).

Released under the MIT License.