Hi,
Are the fields from_date and to_date Date Fields? If they are then the rawValue will be in the yyyy-mm-dd. Using the Date constructor to parse a date has always been inconsistent across environments. I think that Reader DC (which has JavaScript 2.8) handles the yyyy-mm-dd but the earlier versions don't (which expect the dd mmm yyyy format). This might depend on the locale used as well. You might be better using the util.scand() method which is more reliable, so;
//set the variables
var oneDay = 24*60*60*1000;
var firstDate = new Date(util.scand("yyyy-mm-dd", from_date.rawValue).setHours(0,0,0,0));
var secondDate = new Date(util.scand("yyyy-mm-dd", to_date.rawValue).setHours(0,0,0,0));
//only if the 2 date fields aren't null
if ((from_date.rawValue!=null)&&(to_date.rawValue!=null)){
num_days.rawValue
= Math.abs((firstDate.getTime() - secondDate.getTime())/(oneDay));
}
Regards
Bruce