Still very new to Arcade and trying to copy from a script I saw on the community.
I get an error when using this: Expression must return a number value. Any help is appreciated! I am testing this out with the last edit date Esri field but will eventually be adding in another field that calculates the date of an inspection.
var edit_datetime = Date($feature.last_edited_date);
var result = "No information available";
if (IsEmpty(edit_datetime)) {
result = "Invalid date";
} else {
var now_datetime = Now();
var days_dif = DateDiff(now_datetime, edit_datetime, "days");
var today_date = Today();
var edit_date = Date(Year(edit_datetime), Month(edit_datetime), Day(edit_datetime));
if (today_date == edit_date) {
result = "Inspected today";
} else if (days_dif < 31) {
result = "Inspected Recently (Within Last Month)";
} else if (days_dif < 90) {
result = "Inspected (Within Last 3 Months)";
} else {
result = "Not Inspected";
}
}
return result;