Calculating elapsed time

I’m grabbing 2 different “time” variables from 2 different virtual buttons when triggered and adding them to the payload and as a workflow storage value
In the debug window, time shows as “Tue Aug 18, 2020 10:48:26.738 GMT-04:00”
Which node and format helper is best to use to calculate the time difference between these 2 values?

I tried using the DATE/TIME node, but I get “invalid date: undefined” message in debug.

Hi @Lars_Andersson,

Would you be able to include a screenshot of your configuration for this node? The Date/Time Node is the approach I would have recommended, and so I would like to look a bit further into the error you are seeing.

You also have the option of using the {{formatDateRelative}} Helper, but this will format your value as a relative string: “about six minutes ago.”

Thanks!
Julia


image

I had a combination of mistakes.

  1. I needed to format the time to unix time.
  2. Both time values wasn’t available at the time for diff calc.

I’m good now.

1 Like