function CheckDates() {
var ExtendToDate = GetFieldValue("Extend to Date");
var LastLeaverDate = GetFieldValue("ARP Mandatory Exit Date");
var difference = moment.duration(moment(LastLeaverDate, 'MM-DD-YYYY') -
moment(ExtendToDate, 'MM-DD-YYYY')).asDays();
if(difference < 30) {
alert("This persons will have to leave within 30 days of the proposed extension");
}
}
function CheckDates_WithDelay() {
// Delay 1000 milliseconds before starting CheckDates
setTimeout("CheckDates()",1500);
}
AddChangeCallback("ARP_MANDATORY_EXIT_DATE", CheckDates_WithDelay);
AddChangeCallback("EXTEND_TO_DATE", CheckDates_WithDelay);
On the form the user can change both the Extend to Date and ARP Exit date. So that is why i added the change call back and the delay. I've tested it numerous times but i get no alert...
Appreciate your help.