I am picking up two dates and comparing them however somehow they are not matching.
The sheet format shows same as string "12/9/2019" However, when I compare it through script it does not match. I logged and check both the date format appears: Mon Dec 09 2019 00:00:00 GMT+0530 (India Standard Time)
even though its not matching.
Mentioned below is my code:-
var ss = SpreadsheetApp.openById('xxxxx');
var sheet = ss.getSheetByName("Form Responses 1");
var sheet2 = ss.getSheetByName("Database");
var dateinfo = sheet2.getRange("N25").getValue();
var data = sheet.getDataRange().getValues();
var date1 = new Date(dateinfo)
var a = data.filter(function(item){return (item[6]< dateinfo);})
var b = data.filter(function(item){return item[3]==="S2" && (item[6] === dateinfo);})
var c = a.concat(b);
Logger.log(c)
Just to inform you that both the array a,b should return something as there is data matching their condition.