Avatar

Level 1

I fixed the statement by figuring out what the value of the rentalend field was. In the code it was if rentalend.rawValue != "". Well the value was being calculated somewhere or else I wouldnt have been getting a result. So I changed the code to reflect " if(rentalend.rawValue > "1") " and it worked! Thank you so much!

Here is the full working code for those that need it as well.

var oneDay = 24*60*60*1000;

if(rentalend.rawValue > "1") {

var firstDate = new Date(rentalbegin.rawValue);

var secondDate = new Date(rentalend.rawValue);

Math.abs((firstDate.getTime() - secondDate.getTime())/(oneDay));

}

else {

"";

}