Disabling weekends from Flatpickr | XM Community
Skip to main content
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

}

}
@Rchriske



Add the following to the Header in the Look & Feel:

!



Then add this to the questions JavaScript editor:

!
@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!!!!!

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


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



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

image.png


Leave a Reply