Flatpickr: How can I disable the month dropdown?

Created on 4 Jun 2019  Â·  15Comments  Â·  Source: flatpickr/flatpickr

I want the month and year to be static values, but month is a dropdown and year is an input. How can I achieve this?

Most helpful comment

Hadn't realized this might be such a big problem. @chmln can I go ahead with an option to disable the month and year selectors respectively?

Something like:

monthSelectorType: dropdown|static
yearSelectorType: input|static

All 15 comments

Hey @ohtanya

The easiest way to do that is revert to v4.5.7 which doesn't have the month dropdown.

@chmln I'm actually using the react component https://github.com/haoxins/react-flatpickr, so I'm not sure how to avoid using the latest version. I even tried to update all instances of flatpickr@^4.5.7 to [email protected] but that didn't work.

@ohtanya in that case the easiest way to solve this is just forking react-flatpickr and pinning the version in package.json to "flatpickr": "4.5.7"

I would like to disable it too. But looks like if I pin it to 4.5.7, I will be missing the bug fixes and improvements?

Hadn't realized this might be such a big problem. @chmln can I go ahead with an option to disable the month and year selectors respectively?

Something like:

monthSelectorType: dropdown|static
yearSelectorType: input|static

@viorelsfetea Yes, although the option for the year seems not necessary just yet

@viorelsfetea
I was looking for this option great work by the way.
Is this already working and good to use?

Disable the month and year dropdown/input field and only have the left and right arrow to change month. That would be very useful for me. Something like…

monthSelectorType: static
yearSelectorType: static

…would be a perfect solution.

This has been released in v4.6.2

This has been released in v4.6.2

What about the year? :)

Thanks for adding the monthSelector!

In my use case only dates in the near future are picked. Disable the year too would be a real benefit for me, because no one chooses a date a year ahead. If so, they could still click the arrow a couple of times…

Hadn't realized this might be such a big problem. @chmln can I go ahead with an option to disable the month and year selectors respectively?

Something like:

monthSelectorType: dropdown|static
yearSelectorType: input|static

But if set 'showMonths': 2(or more) then option 'monthSelectorType': 'dropdown' doesn't work. Help me please, how can I do it?
Screenshot_32

I am looking for the same solution regarding disabling the year being input as no one will select a year ahead, it would be good just to have the left and right arrows. I have done monthSelectorType: "static" and works perfect for the month but the year is a input field and on hover it shows the up and down arrows to change the year to a year in the future. Is there any solution yet on version 4.6.3?

+1 for the _yearSelectorType_ option

For the month drop down, monthSelectorType: "static",
to disable the year input you can use the cur-year class in css and make the pointer-events to none and it's disabled, about the arrows use both classes arrowUp and arrowDown display none and they're gone

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Spoki4 picture Spoki4  Â·  3Comments

mgohin picture mgohin  Â·  4Comments

pimskie picture pimskie  Â·  3Comments

mchaves-ciandt picture mchaves-ciandt  Â·  3Comments

deangibson89 picture deangibson89  Â·  3Comments