You mean some simple javascript such as:
`$= const msec = dv.pages('"00-Administrative/Daily/2024"').timeinterval.values.reduce((a, b) => { const t = b.split(":"); const add=moment.duration({hours: t[0], minutes: t[1], seconds: t[2]}); return a+add }, moment.duration(0, "s")) ; moment.utc(msec).format("HH:mm:ss")`
HeHe… Sorry couldn’t help myself, but there is not anything simple about this
Contrary to the other calculations we need to do this in two steps, I think. Where the first step is to use reduce
on the timeinterval
to calculate the duration in milliseconds, and then we use a little trick to display that duration in the more common “HH:mm:ss” format.
In order to calculate the duration we need to convert the timeinterval
to a duration, and that is done through splitting the parts on the colon, :
, and using moment.duration()
to create a new duration. After this conversion, it’s kind of a standard reduce()
operation.
Hopefully this works at your end too!
Here is the same script in a slightly more verbose form:
const msec = dv.pages('"00-Administrative/Daily/2024"')
.timeinterval.values
.reduce((a, b) => {
const t = b.split(":");
const add=moment.duration({
hours: t[0], minutes: t[1], seconds: t[2]});
return a+add
}, moment.duration(0, "s")) ;
moment.utc(msec).format("HH:mm:ss")`