Hi!
I'm trying to set up a calendar for a survey that's part of a longitudinal study, and I want the respondent to select a date that is between when they last took the survey (embedded data) and today. I'm unfamiliar with JS. This is what I have so far:
Qualtrics.SurveyEngine.addOnload(function () {
var mindate = "${e://Field/subdate_v1_cal}"
var input = jQuery("#"+this.questionId+" .InputText");
input.flatpickr({
dateFormat: "m/d/Y",
minDate: mindate ,
maxDate: "today"
});
});
Does anyone have any ideas? Thank you!!
Solved
Setting minDate with embedded data in Flatpickr
Best answer by TomG
https://www.qualtrics.com/community/discussion/11202/setting-mindate-with-embedded-data-in-flatpickrGoing back to your original post, your date format was wrong because your piped in date doesn't have leading zeros on month and day. Try:
Qualtrics.SurveyEngine.addOnload(function () {
var mindate = "${e://Field/subdate_v1_cal}"
var input = jQuery("#"+this.questionId+" .InputText");
input.flatpickr({
dateFormat: "n/j/Y",
minDate: mindate ,
maxDate: "today"
});
});
Leave a Reply
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.