Plugins

Plugins are in essentially a set of hooks, that receive a config object (optionally) 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
{
    "enableTime": true,
    "plugins": [new confirmDatePlugin({})]
}

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

Here are all the available options:

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

weekSelect

For selecting a week.

new Flatpickr({
    "plugins": [new weekSelectPlugin({})],
    "onChange": [function(){
        // extract the week number
        // note: "this" is bound to the flatpickr instance
        const weekNumber = this.selectedDates[0]
            ? this.config.getWeek(this.selectedDates[0])
            : null;

        console.log(weekNumber);
    }]
});