Options
An always up-to-date list of options may be found at options.ts
| Config Option | Type | Default | Description |
|---|---|---|---|
| altFormat | String | "F j, Y" | Exactly the same as date format, but for the altInput field |
| altInput | Boolean | false | Show the user a readable date (as per altFormat), but return something totally different to the server. |
| altInputClass | String | "" | This class will be added to the input element created by the altInput option. Note that altInput already inherits classes from the original input. |
| allowInput | Boolean | false | Allows the user to enter a date directly into the input field. By default, direct entry is disabled. |
| allowInvalidPreload | Boolean | false | Allows the preloading of an invalid date. When disabled, the field will be cleared if the provided date is invalid |
| appendTo | HTMLElement | null | Instead of body, appends the calendar to the specified node instead*. |
| ariaDateFormat | String | "F j, Y" | Defines how the date will be formatted in the aria-label for calendar days, using the same tokens as dateFormat. If you change this, you should choose a value that will make sense if a screen reader reads it out loud. |
| conjunction | String | null | When in "multiple" mode, conjunction is used to separate dates in the entry field. |
| clickOpens | Boolean | true | Whether clicking on the input should open the picker. You could disable this if you wish to open the calendar manually with.open() |
| dateFormat | String | "Y-m-d" | A string of characters which are used to define how the date will be displayed in the input box. The supported characters are defined in the table below. |
| defaultDate | String | null | Sets the initial selected date(s). If you're using Otherwise, you can supply a single Date object or a date string. |
| defaultHour | Number | 12 | Initial value of the hour element. |
| defaultMinute | Number | 0 | Initial value of the minute element. |
| disable | Array | [] | See Disabling dates |
| disableMobile | Boolean | false | Set disableMobile to true to always use the non-native picker.By default, flatpickr utilizes native datetime widgets unless certain options (e.g. disable) are used. |
| enable | Array | undefined | See Enabling dates |
| enableTime | Boolean | false | Enables time picker |
| enableSeconds | Boolean | false | Enables seconds in the time picker. |
| formatDate | Function | null | Allows using a custom date formatting function instead of the built-in handling for date formats using dateFormat, altFormat, etc. |
| hourIncrement | Integer | 1 | Adjusts the step for the hour input (incl. scrolling) |
| inline | Boolean | false | Displays the calendar inline |
| maxDate | String/Date | null | The maximum date that a user can pick to (inclusive). |
| minDate | String/Date | null | The minimum date that a user can start picking from (inclusive). |
| minuteIncrement | Integer | 5 | Adjusts the step for the minute input (incl. scrolling) |
| mode | String | "single" | "single", "multiple", or "range" |
| nextArrow | String | > | HTML for the arrow icon, used to switch months. |
| noCalendar | Boolean | false | Hides the day selection in calendar. Use it along with enableTime to create a time picker. |
| onChange | Function, [functions] | null | Function(s) to trigger on every date selection. See Events API |
| onClose | Function, [functions] | null | Function(s) to trigger on every time the calendar is closed. See Events API |
| onOpen | Function, [functions] | null | Function(s) to trigger on every time the calendar is opened. See Events API |
| onReady | Function, [functions] | null | Function to trigger when the calendar is ready. See Events API |
| parseDate | Function | false | Function that expects a date string and must return a Date object |
| position | String | "auto" | Where the calendar is rendered relative to the input vertically and horizontally. In the format of "[vertical] [horizontal]". Vertical can be auto, above or below (required). Horizontal can be left, center or right.e.g. "above" or "auto center" |
| positionElement | Element | null | The element off of which the calendar will be positioned. |
| prevArrow | String | < | HTML for the left arrow icon. |
| shorthandCurrentMonth | Boolean | false | Show the month using the shorthand version (ie, Sep instead of September). |
| static | Boolean | false | Position the calendar inside the wrapper and next to the input element*. |
| showMonths | Integer | 1 | The number of months to be shown at the same time when displaying the calendar. |
| time_24hr | boolean | false | Displays time picker in 24 hour mode without AM/PM selection when enabled. |
| weekNumbers | Boolean | false | Enables display of week numbers in calendar. |
| wrap | Boolean | false | Custom elements and input groups |
| monthSelectorType | String | "dropdown" | How the month should be displayed in the header of the calendar."dropdown" or "static"If showMonths has a value greater than 1, the month is always shown as static. |
* Attaching the calendar to a specific element makes it depend on that element’s position and style. If the calendar is not positioned as expected, check the CSS rules of the container.