How can I revise my script to compare lastInspectionDate and currentDate by month? I need to be able to determine if the last inspection was completed in the current month.
var lastInspectionDate = Date($datapoint["Inspected_Date"]);
var currentDate = Today();
var checkDates = ceil(DateDiff(currentDate, lastInspectionDate , 'days'));
var returnResults = When(checkDates <= 30, '#abf7b1',
checkDates > 30 && checkDates < 100, '#ff6863',
checkDates >= 100, '#',
'NA');
// Apply same background color to each cell in row
for (var cell in row.cells) {
row.cells[cell].backgroundColor = returnResults;
}
// Display icon
row.cells.Inspected_Date.iconName = When(checkDates <= 30, 'done',checkDates > 30 && checkDates < 100,'alert',checkDates > 100,'not_done', '');
return row