What is the method to increase a date by several days in Google Sheets?

I am having trouble adding days to a date using Google Apps Script in Google Sheets. I have the following code snippet:

for (var index = 0; index < inputData.length; ++index) {
    var currentRow = inputData[index];
    var vehicle = currentRow[1];
    var originalDate = currentRow[2];

    if ((vehicle == "VehicleA") || (vehicle == "VehicleB")) {
        var updatedDate = new Date(originalDate.getTime() + (154 * 24 * 60 * 60 * 1000));
        console.log(updatedDate);
    }
}

I attempted to use new Date(originalDate.add({days: 154})); but encountered an error indicating that add() wasn’t recognized. I suspect there might be an issue with the date format in Sheets, which looks like 7/26/2014.

hey, you can use Utilities.formatDate() if you’re manipulating the date in scripts and need specific formatting. Make sure originalDate is valid by logging it before using it. If it’s formattion issue, that may clarify. Also, add() doesn’t exist for date objs, so your initial logic is the way to handle adding days.