I am super new to javascript, so sorry ahead of time! I have a code that I want to send an email reminder when a date on my google-sheet is less than or equal to current date. Right now it is just equal to.
I have tried to change = to <= but then the code does not work
cellValue = row[2];// date specified in cell C
if (!cellValue) {continue;}//If there is no cell value continue looping
if (typeof cellValue === 'object') {
reminderDate = cellValue.toLocaleDateString();
} else {
cellValue = new Date(cellValue);//Convert date as string to object
reminderDate = cellValue.toLocaleDateString();
}
if (reminderDate != today) // Skip this reminder if not for today
continue;
Try something like this:
if (row[2]) {
var reminderDate=new Date(new Date(row[2]).getFullYear(),new Date(row[2]).getMonth(),new Date(row[2]).getDate()).getTime();
var today=new Date(new Date().getFullYear(),new Date().getMonth(),new Date().getDate()).getTime();
if(reminderDate<today)continue;
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.