Need help with a computed field

var d = document1.getItemValueDate(“lastMaintRep1”);
if(d == null) {
return “date is empty or doesn’t exist.”
} else {
return d.toLocaleString();

I have a computed field on an xpage that does not want to work!!

Not sure what I am doing wrong

The xpage has a date field lastMaintRep (last maintenance report date in real life)

I have another field with number of days until the next maintenance is due (field name is Frequency)

I need a computed field to show the date of the next due maintenance by taking the last date and adding on the frequency (in days) @ adjust etc

Thanks

Subject: get the notesdatetime

I think you just have to get the notesdatetime… something like

var ndt = document1.getItemValueDateTime(“lastMainRep1”);

if(ndt.getDateOnly()==“”){return null;}

var freq = document1.getItemValueDouble(“Frequency”);

var newdt = @Adjust(ndt.getLocalTime(),0,0,freq,0,0,0);

//convert to java date for display formatting

var jdt = newdt.toJavaDate();

jdt