Dennis Thrysøe
Dennis Thrysøe

Reputation: 1911

How to close and reset easepick date picker

I am using the easepick date picker to select date ranges.

I am surprised that I can not find anything in the docs about having an "OK" button or similar, that makes the date selection, and hides the date picker. What are the options for selecting the dates and hiding the picker?

Also I see no way that I can reset the date fields again. In my case they can have dates or be unspecified. But after selecting dates, I cannot set them back to "empty" again. How can that be done?

Upvotes: 0

Views: 302

Answers (1)

Richard Maly
Richard Maly

Reputation: 1

To Reset the picker via the interface you can add a reset button. this is done by using in the AmpPlugin see https://easepick.com/packages/amp-plugin.html#option-resetButton

for example

 const picker = new easepick.create({
     element: document.getElementById(displayElement),
     css: [
         'https://cdn.jsdelivr.net/npm/@easepick/[email protected]/dist/index.css'
     ],
     format: "DD MMM YYYY",
     zIndex: 1000,
     plugins: ['RangePlugin', 'AmpPlugin'],
     RangePlugin: {
         delimiter: " to "
     },
     AmpPlugin: {
         resetButton: true
     }
 });

This adds the button on the top right as seen in the picture below. [1]: https://i.sstatic.net/51yGuLWH.png

Upvotes: 0

Related Questions