Storing embedded data value in date format | XM Community
Skip to main content

Hi All,

 

I am using following JS code to store date in ‘fsi’ embedded data field in ‘DD-MMM-YYYY' format but when Im’ exporting the excel file the date is getting stored as a text. Is there a way in which excel stores the same field in date format?    

 

Qualtrics.SurveyEngine.addOnReady(function(){
    
    var maxDate = "${e://Field/lpi}"; 
      maxDate = moment(maxDate, "DD-MMM-YYYY").format("Y-MM-DD");
    
    jQuery("#"+this.questionId+" .InputText").flatpickr({altInput: true, altFormat: "F d, Y", dateFormat: "Y/m/d",
                                                          minDate: new Date(), maxDate: maxDate });
});

Qualtrics.SurveyEngine.addOnPageSubmit(function() {
    
    var fsi = document.getElementById('QR~QID45').value;    
    var lpi = moment("${e://Field/lpi}", "DD-MMM-YYYY").format("YYYY-MM-DD");
    var maxdays = moment(lpi).diff(fsi, 'days', true).toFixed(0);
    var fsi = moment(fsi).format("DD-MMM-YYYY");
    Qualtrics.SurveyEngine.setEmbeddedData('fsi', fsi);
    Qualtrics.SurveyEngine.setEmbeddedData('maxdays', maxdays);
    
});

Be the first to reply!

Leave a Reply