Hello community,
I included a custom javascript in my survey to get the local date and time when my respondents load the survey page. The logic flow I set in the survey then used these variables in the javascript as embedded data to decide which page to display. The codes work like a charm only with Chrome on my mac. _However, it didn't work on safari on mac nor safari/chrome on my iPhone/iPad._ Below is the script I included in my survey:
var d = new Date();
Qualtrics.SurveyEngine.setEmbeddedData("hour", d.getHours());
var start = new Date(2019-3-3),
end = new Date(),
diff = new Date(end - start),
days = Math.floor (diff/1000/60/60/24);
Qualtrics.SurveyEngine.setEmbeddedData('day',days);
Any thoughts why such an issue, and how I can make it to work across browsers and devices? Thanks!
Page 1 / 1
@echongsk,
My guess is that Safari isn't parsing 2019-3-3 correctly. Date parsing is inconsistent among browsers. I recommend using moment.js moment.js for anything beyond basic date handling such as parsing, arithmetic and formatting.
My guess is that Safari isn't parsing 2019-3-3 correctly. Date parsing is inconsistent among browsers. I recommend using moment.js moment.js for anything beyond basic date handling such as parsing, arithmetic and formatting.
Thanks for your reply, @TomG! How do you install moment.js in qualtrics? I'm not experienced with this. Any suggestions would be helpful. Thank you!
Leave a Reply
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.