JavaScript Not Working on Mobile Devices | XM Community
Skip to main content

I have a JavaScript in my survey to calculate the difference between the date entered and the current date. It is working perfectly on a web browser, but not working on mobile devices. 

 

The current code is as follows:

Qualtrics.SurveyEngine.addOnPageSubmit(function()
{
const currentDate = Qualtrics.SurveyEngine.getEmbeddedData("currentDate");
const currentQuestionValue = this.getChoiceAnswerValue();

const dateDifference2 = new Date(currentQuestionValue).getTime() - new Date(currentDate).getTime() ;
Qualtrics.SurveyEngine.setEmbeddedData("dateDifference2", dateDifference2);

console.log("Current Date: " + currentDate)
console.log("Current Question Value: " + currentQuestionValue)
console.log("Date Difference2 : " + dateDifference2)
});

 

Anyone know how to adjust the code to make it compatible with phones? 

Be the first to reply!

Leave a Reply