Disabling weekends from Flatpickr | XM Community
Skip to main content
Solved

Disabling weekends from Flatpickr

  • December 3, 2019
  • 5 replies
  • 824 views

Rchriske
I would like disable weekends from the calendar and exclude those weekend dates when using minDate. Example: I only want to allow people to select a date that is at least 5 business days away from the current date. I found the code for disabling weekends on the flatpickr site but I don't where to up the code. A similar question has been asked before, but I still cannot figure out where to put it! My current code: Qualtrics.SurveyEngine.addOnload(function() { jQuery("#"+this.questionId+" input[type=text]").flatpickr({ dateFormat: "m/d/Y", minDate:new Date().fp_incr(5)}); }); Disabling weekend code found on flatpickr { "disable": [ function(date) { // return true to disable return (date.getDay() === 0 || date.getDay() === 6); } ], "locale": { "firstDayOfWeek": 1 // start week on Monday } }

Best answer by dobra021

@Rchriske Add the following to the Header in the Look & Feel: ! Then add this to the questions JavaScript editor: !

5 replies

dobra021
Level 4 ●●●●
Forum|alt.badge.img+37
  • Level 4 ●●●●
  • Answer
  • December 6, 2019
@Rchriske Add the following to the Header in the Look & Feel: ! Then add this to the questions JavaScript editor: !

Rchriske
  • Author
  • December 6, 2019
@dobra021 , you are amazing! I can't tell you how long I've been working on this issue. I wish I would have asked sooner. THANK YOU!!!!!

Forum|alt.badge.img+2

Do you know how to add a feature that only allows for 14 days out?


dobra021
Level 4 ●●●●
Forum|alt.badge.img+37
  • Level 4 ●●●●
  • August 3, 2021

Flintstone81
add the following:
maxDate: new Date().fp_incr(14),



Forum|alt.badge.img+2

Hi, do you know if I can get the total of two constant sums to go into a new question automatically?

image.png