Again some feedback on a recent request on how to work with date properties and compare them to the current date. Lets assume an object (item, requirement or anything else) has a custom "Due Date" property and based on that and the current date, another property shall simply state whether the object is "due" or not.
I worked on the Item so I have all properties defined there:

Dates are internally stored as a Unix Time Stamp which is an integer value representing the number of milliseconds since January 1, 1970, 00:00:00 UTC (same as most tools and languages meanwhile do). Luckily Java Script is doing the same so the script for "Delay" looks simply like this:
// we assume a date property named "dueDate"
var dueDate = self.dueDate;
if (dueDate) {
// due date is an integer value
var diff = Date.now() - dueDate;
if (diff > 0) {
"[!] Delayed";
} else {
"[i] On Time";
}
} else {
undefined;
}
and results in

resp. in

Th script can of course be improved, it currently just checks a delta between now and due date but does not consider any time part.
Happy Scripting
Jan