Problem: Spreadsheet isn't recognizing an input date as a Date(), so I can't get the .getTime() from it in Apps Script.
Question: Can you see why this is?
Results: Here is a part of the script I'm running:
dates.map(function(inp) {
if (inp != undefined && inp !== ""){
inp = new Date(inp.getTime() - (date.getTimezoneOffset()*60000);
return inp
}
});
where dates refers to a range: dates = sheet.getRange(2,1, lastR, 1).getValues();
Currently this range has a manually inputed value of "2017-05-20" which Spreadsheet automagtically recognizes as the date "Sat May 20 2017 00:00:00 GMT+0200 (CEST)"
The error reads as follows:
TypeError: Cannot find function getTime in object Sat May 20 2017 00:00:00 GMT+0200 (CEST). (line 86, file "Code") Details Dismiss
I have tried a million ways throughout my script to get Spreadsheet to stop autoconverting the input values as dates, so that I can make then at least timestamps or something. Does any one know why it is doing this?