Javascript for counting time taken to fill a survey

Answered

Comments

2 comments

  • Rainer Grabowski

    Hi Anish,
    this code should work. It grabs the end-time and does the calculation when the Status changes to "Completed" . As long as the Status is "In Progress" it shows nothing (empty field). It must be end.diff(start...) , with start.diif(end ...) you'll get a negative number. I would take minutes/60 as unit, cause it will deliver a more precise value.

    var start = moment(@Created On);
    var end = moment();
    @survey status == "Completed" ? end.diff(start,'minutes')/60 : ""
    

    Rainer
    rg@delos-consulting.com

    1
    Comment actions Permalink
  • Anish Pillai

    Thank you so much Rainer. It works the way I wanted it.

    0
    Comment actions Permalink

Please sign in to leave a comment.

Powered by Zendesk