Time diff moment add parameter

Hi there,
What about adding also the unit in the Diff operator?


The default is msec, but would be nice to have an optional parameter to change the units.
Cheers.

Hi @Paolo_Proxy !

Indeed, the Date/Time Node diff operator produces an output in milliseconds, with no other built-in options to reformat. I will open a feature request to have this feature evaluated.

You can use a Math Node to convert the output from milliseconds to the desired unit (such as dividing by 1000 to convert to seconds).

Depending on your workflow, it might be easier to skip the Date/Time Node altogether and use the {{formatDateRelative date relativeTo}} helper to calculate the difference between two time values.

Thanks for the feedback!

1 Like

Ah yes interesting:

Outputs a relative date value (such as “5 minutes ago”). Date is calculated relative to the relativeTo parameter, which defaults to the current time when not set. When used in a dashboard, this will use the current browser locale when formatting.

But what is the actual object type, is it a time interval?

@Paolo_Proxy

The output of the formatDateRelative helper is a string (as you noted, something like "5 minutes ago").

Which object are you referring to?