I have the following Javascript in a Qualtrics project that works perfectly on a computer, but not on a mobile device...
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)
});
The "dateDifference2" field is blank when survey is completed on phone