Search code examples
javascripttypescriptflatpickr

How to install a Flatpickr plugin


I'm starting to use flatpickr (moving from xdsoft datetimepicker, which seems no longer actively maintained) and would like to achieve scrolling behavior just like xdsoft's datetimepicker had, i.e. allowing scrolling between months with the mouse scroll wheel.

I see on https://github.com/flatpickr/flatpickr/pull/1192 that the functionality used to be there in the past, but that it was removed. On the plugins repo, I see a scrollPlugin.ts which I assume is what I'm looking for.

However I cannot find in the docs how to install this plugin.

I'm not using NPM or so but am loading the flatpickr js/css files directly:

<link rel="stylesheet" href="/static/flatpickr/material_blue.css">
<script src="/static/flatpickr/flatpickr.js"></script>

What is the proper way to install a TS plugin? Assuming TS stands for Typescript, do I need to transform it to JS and if so how?

Using Flatpickr 4.6.9 (latest one as time of writing).


Solution

  • Seems you need to include the plugin file

    like

    <script src="https://unpkg.com/[email protected]/dist/plugins/scrollPlugin.js"></script>