I want an alert to pop up if today's date is greater than the date in cell data (Overdue date). So, I used "IF" statement in the Script but it's not working. Either today's date is greater, less or equal to the data date, the alert will always pop up. If the date is not overdue it should not pop up the alert message.
function onOpen(e){
var sh1=SpreadsheetApp.getActiveSpreadsheet();
var test1=sh1.getSheetByName("3rdEdition-Pindaan1");
var iso=SpreadsheetApp.getUi();
var date=Utilities.formatDate(new Date(),"GMT+8","dd-MMM-yyyy");
var d1=Utilities.formatDate(test1.getRange("F18").getValue(),"GMT+8","dd-MMM-yyyy");
if (d1<=date)
{
iso.alert('Please update the outdated documents');
}
}