Plugins

Plugins are essentially a set of hooks, that receive an optional config object and a flatpickr instance.

Functionality requested by users that doesn’t make it to core usually ends up in a plugin. The flatpickr repo comes with a few plugins.

confirmDate

Provides a visual cue for users after selecting either:

  • date + time
  • multiple dates
  1. {
  2. "enableTime": true,
  3. "plugins": [new confirmDatePlugin({})]
  4. }

A spiffy SVG icon is included, along with sane defaults, but you can customize them.

Here are all the available options:

  1. {
  2. confirmIcon: "<i class='fa fa-check'></i>", // your icon's html, if you wish to override
  3. confirmText: "OK ",
  4. showAlways: false,
  5. theme: "light" // or "dark"
  6. }

weekSelect

For selecting a week.

  1. flatpickr({
  2. "plugins": [new weekSelect({})],
  3. "onChange": [function(){
  4. // extract the week number
  5. // note: "this" is bound to the flatpickr instance
  6. const weekNumber = this.selectedDates[0]
  7. ? this.config.getWeek(this.selectedDates[0])
  8. : null;
  9. console.log(weekNumber);
  10. }]
  11. });

rangePlugin (beta)

Range selection using two inputs.

  1. flatpickr({
  2. "plugins": [new rangePlugin({ input: "#secondRangeInput"})]
  3. });

MinMaxTimePlugin (beta)

Custom minTime and maxTime per date.

  1. {
  2. enableTime: true,
  3. minDate: "2025",
  4. plugins: [
  5. new minMaxTimePlugin({
  6. table: {
  7. "2025-01-10": {
  8. minTime: "16:00",
  9. maxTime: "22:00"
  10. }
  11. }
  12. })
  13. ]
  14. };

monthSelectPlugin

Show a month-only calendar view

  1. {
  2. plugins: [
  3. new monthSelectPlugin({
  4. shorthand: true, //defaults to false
  5. dateFormat: "m.y", //defaults to "F Y"
  6. altFormat: "F Y", //defaults to "F Y"
  7. theme: "dark" // defaults to "light"
  8. })
  9. ]
  10. };