Using Flatpicker for Month/Year | XM Community
Solved

Using Flatpicker for Month/Year

  • 6 August 2022
  • 2 replies
  • 6331 views

Badge

Hello again!
I'm trying to use Flatpicker to set dates in month/year format.
I put it in the Look and Feel; General; Header in the source code view.


It saves, but when I try to Apply, it never finishes.
Any suggestions much appreciated.
Sincerely,
Erin

icon

Best answer by Tom_1842 8 August 2022, 15:38

View original

2 replies

Userlevel 7
Badge +27

Hi there, I have used flatpickr's MonthSelect plugin to select dates in Month-Year format. Try putting the below in your survey's Header:





Then in the JavaScript for your Text Entry question, add the below:
jQuery("#"+this.questionId+" .InputText").flatpickr({
    disableMobile: "true",
plugins: [
    new monthSelectPlugin({
shorthand: true,
    dateFormat: "m/Y",
    altFormat: "F Y",
    theme: "material_blue"
    })
 ]
    });

Badge

I actually figured it out myself, and it works great!
Thank you,
Erin

Leave a Reply