Skip to content

Feature Request: Months and Years only picker #269

Open
@dev4press

Description

@dev4press
Contributor

Check out datetime picker that offers method for picking only month or only year: http://t1m0n.name/air-datepicker/docs/#example-months.

It would be great to have something like that available in Flatpickr.

Milan

Activity

chmln

chmln commented on Sep 16, 2016

@chmln
Member

Hello,

To be honest, I don't find this a necessary, or even very usable to be worth the effort of implementing.
Also, a lot of clicking there, and no options of direct input.

A couple of selects would be much easier to use

thejae

thejae commented on Mar 28, 2017

@thejae

+1 for this feature. May suggest the implementation of year range selection as well. For eg; Jan 2001 - Dec 2010

Guoxweii

Guoxweii commented on Jul 13, 2017

@Guoxweii
  • 1
heyange2002

heyange2002 commented on Jul 24, 2017

@heyange2002

+1

RedShift1

RedShift1 commented on Nov 14, 2017

@RedShift1

+1 Seems like a nice usability improvement in cases where you're working with months and selecting a day wouldn't make sense.

davestewart

davestewart commented on Aug 15, 2018

@davestewart

A couple of selects would be much easier to use

@chmln

We've just started using this at a bank, and choosing by month is something we do a lot.

It's a perfectly valid use case, especially when we only want to rely on a single configurable date-picker component.

reopened this on Aug 15, 2018
chmln

chmln commented on Aug 15, 2018

@chmln
Member

Now that scrolling is removed, let's make this happen :)

davestewart

davestewart commented on Aug 15, 2018

@davestewart

That's great news! The team is stoked 😁

davestewart

davestewart commented on Aug 28, 2018

@davestewart

@chmln - of course, we're interested to track the progress of any work on this.

Is there an ETA, or some way for us to do this?

I'd be happy to work on this myself, though my knowledge of Flatpickr is minimal.

Just checking out the docs, it seems that in the first instance, the time picker JS and UI could be repurposed.

{
    enableTime: true,
    noCalendar: true,
    dateFormat: "H:i",
}

I might get one of our guys to look at this next week...

ngstwr

ngstwr commented on Oct 3, 2018

@ngstwr

@chmln Is there a timeline for this or is it already implemented? I couldn't find any option or mention on documentation.

chmln

chmln commented on Oct 3, 2018

@chmln
Member

Hey all, I wish I could provide an ETA but I can't at the moment. It will be as soon as I can get some chunk of free time, within a month or two. Extremely busy at the moment in my final year at university.

If anyone wants to work on this - please go ahead, but keep it plugin-based as flatpickr core should not get any larger.

Thank you all for patience. :)

paolog22

paolog22 commented on Nov 20, 2018

@paolog22

+1 for this user make the Month and Year Select/Dropdown for easy navigation, rather than clicking multiple times just to navigate

28 remaining items

mordekasg

mordekasg commented on Jun 3, 2019

@mordekasg

I can't seem to get this to work. I used the code that was included in the pull request and included the index.js plugin file, but it can't find the JS class monthSelect. How can I get this working?

Use: monthSelectPlugin.

croane

croane commented on Jun 4, 2019

@croane

Thanks, @mordekasg! This config worked:

{
  static: true,
  altInput: true,
  plugins: [new monthSelectPlugin({shorthand: false, dateFormat: "Y-m-d", altFormat: "M Y"})]
}
Kinjalbagaria

Kinjalbagaria commented on Jun 5, 2019

@Kinjalbagaria

@chmln : Is there any option available to disable this monthSelect? coz I dont want this functionality by default.

abriginets

abriginets commented on Jun 15, 2019

@abriginets

@chmln I agree with @Kinjalbagaria. Please, make new functionality disabled by default. I want a simple text, not ugly <select>.

mikes-gh

mikes-gh commented on Jun 17, 2019

@mikes-gh
Contributor

@Kinjalbagaria @JamesJGoodwin

I think this thread is about the month select plugin which is different to the <SELECT> month function which was added recently. As you have found out <SELECT> doesnt look great in a lot of browsers and cant be styled.

I think you are looking for this issue

#1826

el-mark

el-mark commented on Jun 20, 2019

@el-mark

Thanks, @mordekasg! This config worked:

{
  static: true,
  altInput: true,
  plugins: [new monthSelectPlugin({shorthand: false, dateFormat: "Y-m-d", altFormat: "M Y"})]
}

Should I need to import the monthSelectPlugin on the component? I see this error "Uncaught ReferenceError: monthSelectPlugin is not defined". If some can help please.

mikes-gh

mikes-gh commented on Jun 20, 2019

@mikes-gh
Contributor

You need

<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/flatpickr@latest/dist/plugins/monthSelect/style.css">

in your HEAD section

and

<script src="https://cdn.jsdelivr.net/npm/flatpickr@latest/dist/plugins/monthSelect/index.js"></script>

in your scripts section

artur79

artur79 commented on Mar 11, 2021

@artur79

If anyone struggling with it, here's how to load that plugin in Rails' webpacker

import flatpickr from 'flatpickr'
require("flatpickr/dist/flatpickr.css")

import monthSelectPlugin from 'flatpickr/dist/plugins/monthSelect'
require('flatpickr/dist/plugins/monthSelect/style.css')
ameerjohn

ameerjohn commented on Nov 3, 2021

@ameerjohn

import "./styles.css";
import Flatpickr from "react-flatpickr";
import monthSelectPlugin from "flatpickr/dist/plugins/monthSelect";
require("flatpickr/dist/plugins/monthSelect/style.css");
require("flatpickr/dist/flatpickr.css");

export default function App() {
const options = {
plugins: [
new monthSelectPlugin({
// shorthand: true, //defaults to false
// dateFormat: "F Y", //defaults to "F Y"
// altFormat: "F Y", //defaults to "F Y"
// theme: "light" // defaults to "light"
})
]
};
return (


<Flatpickr options={options} value={new Date()} />

);
}

ameerjohn

ameerjohn commented on Nov 3, 2021

@ameerjohn

import "./styles.css"; import Flatpickr from "react-flatpickr"; import monthSelectPlugin from "flatpickr/dist/plugins/monthSelect"; require("flatpickr/dist/plugins/monthSelect/style.css"); require("flatpickr/dist/flatpickr.css");1635942764127>
export default function App() { const options = { plugins: [ new monthSelectPlugin({ // shorthand: true, //defaults to false // dateFormat: "F Y", //defaults to "F Y" // altFormat: "F Y", //defaults to "F Y" // theme: "light" // defaults to "light" }) ] }; return (

<Flatpickr options={options} value={new Date()} />

);
}

#

carltongibson

carltongibson commented on Jul 19, 2023

@carltongibson

The provided monthselectplugin resolves this issue. I think it could be closed. 🤔

https://flatpickr.js.org/plugins/#monthselectplugin

nmauludina

nmauludina commented on Aug 6, 2023

@nmauludina

The provided monthselectplugin resolves this issue. I think it could be closed. 🤔

https://flatpickr.js.org/plugins/#monthselectplugin

How to use it with cdn?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

    Development

    No branches or pull requests

      Participants

      @carltongibson@davestewart@artur79@dev4press@torlokken

      Issue actions

        Feature Request: Months and Years only picker · Issue #269 · flatpickr/flatpickr