I have a few JS transform where I transform the usual seconds to a human readable time, for example Kodi_CurrentTime. This worked correctly in OH2.x, but now on OH3 I just get NaN. I have tried slicing off the " s" from the end of the string, but that did not helped either. What is the problem here?
(function (i) {
if (isNaN(i)) {
return "NaN";
}
if (i < 0) {
return "Nothing is playing";
}
var secs = Math.floor(i % 60)
var mins = Math.floor(i / 60)
var hours = 0
if (mins >= 60) {
hours = Math.floor(mins / 60)
mins = Math.floor(mins % 60)
}
var pad = "00";
return (pad + hours).slice(-pad.length) + ":" + (pad + mins).slice(-pad.length) + ":" + (pad + secs).slice(-pad.length);
})(input)