Hi All,
I am using below mentioned Jquery to use faltpickr and store some embedded data fields but am facing some issues.
- I am pulling value of minDate from embedded data field which is in the format of ‘DD-MM-YYYY’ but the code is not able to capture that.
- I am calculating maxdays variable by subtracting ‘fsi’ from ‘lpi’ but the code is unable to do so
Can you please help me see if there is any error in the code which might be required to solve above mentioned two issues?
Qualtrics.SurveyEngine.addOnReady(function(){
jQuery("#"+this.questionId+" .InputText").flatpickr({altInput: true, altFormat: "F d, Y", dateFormat: "Y/m/d",
minDate: "${e://Field/date}", maxDate: "${e://Field/lpi}" });
});
Qualtrics.SurveyEngine.addOnPageSubmit(function() {
var fsi = document.getElementById('QR~QID45').value;
var lpi = "${e://Field/lpi}";
moment.locale('en-IN');
var fsi = moment(fsi).format("DD-MM-YYYY");
var lpi = moment(lpi).format("DD-MM-YYYY");
var maxdays = moment(lpi).diff(fsi, 'days', true).toFixed(0);
Qualtrics.SurveyEngine.setEmbeddedData('fsi', fsi);
Qualtrics.SurveyEngine.setEmbeddedData('maxdays', maxdays);
});