Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

is there a way to use monthSelectPlugin , this doesnot seems to work ? #209

Open
innv-imtinan opened this issue Jan 31, 2023 · 2 comments
Open

Comments

@innv-imtinan
Copy link

innv-imtinan commented Jan 31, 2023

<script>
import Flatpickr from 'react-flatpickr'
import monthSelectPlugin from 'flatpickr/dist/plugins/monthSelect';
import '@styles/react/libs/flatpickr/flatpickr.scss'
import 'flatpickr/dist/plugins/monthSelect/style.css'
</script>

<Flatpickr
                value={selectedDate}
                onChange={date => setSelectedDate(date[0])}
                options={{
                    plugin: [
                        new monthSelectPlugin({
                            shorthand: true, //defaults to false
                            dateFormat: "m.y", //defaults to "F Y"
                            altFormat: "F Y", //defaults to "F Y"
                        })
                    ]
                }}

            />
@zavan
Copy link

zavan commented Jul 17, 2023

I was able to make it work, I think you're only missing the plugin CSS import and you have a typo, the option is called plugins, not plugin.

import "flatpickr/dist/flatpickr.min.css";
import "flatpickr/dist/plugins/monthSelect/style.css"; // <-----

import Flatpickr from 'react-flatpickr'
import monthSelectPlugin from "flatpickr/dist/plugins/monthSelect";

<Flatpickr
  value={value}
  onChange={onChange}
  options={{
    plugins: [new monthSelectPlugin()],
  }}
/>

@mrinmay7875
Copy link

Zavan, is correct. I was able to make it work by using the plugins instead plugin. I think we should go ahead and close this issue since it is working as designed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants