I need to compare two dates, activation and expiration date, to be sure that expiration is after.
If I do:
var actDate = api.getProp("activationDate").value;console.log("actDate=" + actDate + " expDate=" + prop.value);
actDate=Wed Jul 18 2018 00:00:00 GMT+0300 (Eastern European Summer Time)
expDate=Fri Jul 20 2018 00:00:00 GMT+0300 (Eastern European Summer Time)
I could write a Java plugin or probably a JS plugin to compare them. Is there a way to do that inside the onchange handler?
You could try this code for your requirement
var actDate = new Date(api.getProp("activationDate").value);
var expDate = new Date(api.getProp("expirationDate").value);
//Convert date to the numerical value format and compare these values
If ((actDate.getTime()) > (expDate.getTime()))
prop.errors = ["Expiration Date is before activation date"];
Thanks a lot, this worked (with Date)!