0 Replies · Latest reply on Jan 3, 2018 1:49 PM by Isaac Chiles

    Comparing Dates in Metric to gauge performance

      I have a field called u_glide_date_1, called Deployment Date. I want to measure that date against closed_at to understand how well our estimated deployment dates match our actual deployment dates. Currently my script is inconsistently reporting times, sometimes it takes the days into account and sometimes not.

       

      var s = current.state;
      if (s == 3)
        createMetric();
      
      function createMetric() {
        var mi = new MetricInstance(definition, current);
        if (mi.metricExists()) 
          return; 
      
        var gr = mi.getNewRecord();
        gr.start = current.closed_at;
        gr.end = current.u_glide_date_1;
        gr.duration = gs.dateDiff(gr.start.getDisplayValue(), gr.end.getDisplayValue());
        gr.calculation_complete = true;
        gr.insert();
      }
      

       

       

      Thanks,

      Isaac