add "format_duration" function
The "formatDate" function is already supported the javascript adapter. It would be great if a "format_duration" function could be added that formats a duration (in milliseconds) to a string. The example below is specific for German and should be enhanced for international usage.
function format_duration(dauer,format_string) {
const tl = 60000*60*24
var days = Math.floor(dauer/tl)
return ((days !== 0) ? days + " Tg " : "") + formatDate((dauer+1) % tl,format_string) + " h"
}
But in fact then abit more would be needed or?!
"37d 7h 5m 2s"? ;-)
if not going higher also also suporting years and months, but this gets problematic ... so easier to "just" start on days, or?
Sure!
Supporting years and months (what is a month anyway?) would be an overkill TMH and I would refrain from that. Flexibility on the units with respect of language would be necessary. And the format you have proposed would also be better.
PS: Maybe the module "format-duration" would also work and leave the final formatting of units to the user.