Hi All, I have two date selection questions in my survey where I would like one of them to only have respondents be able to select Saturdays and the other to only be able to select every other Sunday. Is there a code for this? And how would I input this code? Also, can I add quotas so only a certain number of respondents can select each day? I appreciate your help as I am relatively new to Qualtrics. Thank you in advance!
Custom Calendar-Only Having one day available to select
Best answer by JesperAndersen
Just in cases anyone needs the complete JS, this is tested and working:
Qualtrics.SurveyEngine.addOnReady(function()
{
function getAllSaturdays(year) {
const saturdays = [];
const date = new Date(year, 0, 1); // January 1st of the given year
while (date.getFullYear() === year) {
if (date.getDay() === 6) { // Saturday is day number 6 (0 is Sunday)
const dateString = date.toISOString().slice(0, 10); // Format the date as "YYYY-MM-DD"
saturdays.push(dateString);
}
date.setDate(date.getDate() + 1); // Move to the next day
}
return saturdays;
}
const allSaturdays2023 = getAllSaturdays(2023);
jQuery("#"+this.questionId+" .InputText").flatpickr({
dateFormat: "Y-m-d",
minDate: new Date(),
enable: allSaturdays2023
});
});
Sign up
Already have an account? Login
Welcome! To join the Qualtrics Experience Community, log in with your existing Qualtrics credentials below.
Confirm your username, share a bit about yourself, Once your account has been approved by our admins then you're ready to explore and connect .
Free trial account? No problem. Log in with your trial credentials to join.
No free trial account? No problem! Register here
Already a member? Hi and welcome back! We're glad you're here 🙂
You will see the Qualtrics login page briefly before being taken to the Experience Community
Login with Qualtrics
Welcome! To join the Qualtrics Experience Community, log in with your existing Qualtrics credentials below.
Confirm your username, share a bit about yourself, Once your account has been approved by our admins then you're ready to explore and connect .
Free trial account? No problem. Log in with your trial credentials to join. No free trial account? No problem! Register here
Already a member? Hi and welcome back! We're glad you're here 🙂
You will see the Qualtrics login page briefly before being taken to the Experience Community
Login to the Community
Welcome! To join the Qualtrics Experience Community, log in with your existing Qualtrics credentials below.
Confirm your username, share a bit about yourself, Once your account has been approved by our admins then you're ready to explore and connect .
Free trial account? No problem. Log in with your trial credentials to join.
No free trial account? No problem! Register here
Already a member? Hi and welcome back! We're glad you're here 🙂
You will see the Qualtrics login page briefly before being taken to the Experience Community
Login with Qualtrics
Welcome! To join the Qualtrics Experience Community, log in with your existing Qualtrics credentials below.
Confirm your username, share a bit about yourself, Once your account has been approved by our admins then you're ready to explore and connect .
Free trial account? No problem. Log in with your trial credentials to join. No free trial account? No problem! Register here
Already a member? Hi and welcome back! We're glad you're here 🙂
You will see the Qualtrics login page briefly before being taken to the Experience Community
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.
