DrewW
Mega Sage

Try the below.  It should be doing everything in GMT.

Also why do you care if its open before you use the resolution date?  Why not just check if it has a value and if it does then use it?

(function executeRule(current, previous /*null when async*/) {

	if(current.u_inquiry_date){
		var startDate = current.u_inquiry_date.getGlideObject();
		var endDate = new GlideDateTime();
		if(current.getValue('u_state') != 'Open' && current.u_resolution_date){
			endDate = current.u_resolution_date.getGlideObject();
		}
		var dur = endDate.getNumericValue() - startDate.getNumericValue();
		//convert the answer from milliseconds to days
		var days = dur /  (1000*60*60*24);
		if(days < 1){
			days = 1;
		}
		current.u_resolution_time = days;
	} else {
		current.u_resolution_time = 0;
	}

})(current, previous);

View solution in original post