AnsweredAssumed Answered

JavaScript Date() working in one environment but not in the other. why?

Question asked by ksurisetti290718 on Oct 10, 2018
Latest reply on Oct 10, 2018 by dcollins724067

Error:- 

 

some documents reached an exception which is set to halt all documents: [Output ProfileLocation: Contact/Next_Survey_Date__c; DocumentLocation: /Contact[0]/Next_Survey_Date__c[0]]: Error Formatting Date 'NaN-NaN-NaN', Expected Format yyyyMMdd HHmmss.SSS: Failed parsing 'NaN-NaN-NaN' due to extra trailing character(s) 'NaN-NaN-NaN'; Caused by: Error Formatting Date 'NaN-NaN-NaN', Expected Format yyyyMMdd HHmmss.SSS: Failed parsing 'NaN-NaN-NaN' due to extra trailing character(s) 'NaN-NaN-NaN'; Caused by: Failed parsing 'NaN-NaN-NaN' due to extra trailing character(s) 'NaN-NaN-NaN'

 

A portion of our JavaScript - 

 

Last_Survey_Type_c=Next_Survey_Type_c;
Last_Survey_Date_c=Next_Survey_Date_c;
Next_Survey_Type_c_out="Rel";
var tt = Next_Survey_Date_c;
var date = new Date(tt);
var newdate = new Date(date);
newdate.setDate(newdate.getDate() + 80);
var dd = newdate.getDate();
if(dd.length<2)
{
dd="0".append(dd);
}

var mm = newdate.getMonth() + 1;

if(mm.length<2)
{
mm="0".append(mm);
}
var y = newdate.getFullYear();
var Formatted_Next_Survey_Date = [y,mm,dd].join('-');
Next_Survey_Date_c_out=Formatted_Next_Survey_Date;

Outcomes