I get errors in a JS RuleSet.

I'm trying to calculate the outage duration using downtime.end - downtime.start but my issue is knowing how to do this in a JavaScript Rule in Process Designer.

The 1st line causes error: Count not process script    and    SyntaxError: missing ; before statement
The 2nd & 3rd lines do not calculate a duration.


If ( !system.functions._null(record.downtime_start)  && !system.functions._null(record.downtime_end ) )   {
  var oDur = record.downtime_end.getTime()  - record.downtime_start.getTime() ;
  record.o_downtime_duration = new Date( oDur );

Any help would be appreciated.