JS transform issue

I would like to ‘transform’ the cpu#uptime (in minutes) to a readable format (0d 12h 3m).

The item looks like

Number CPU_Uptime "CPU Uptime [%.0f min]" (gSI) {channel="systeminfo:computer:openHAB2:cpu#uptime" }

The transform is in JS (uptime.js)

(function(minutes){
var days = Math.floor(minutes / 1440);
minutes -= days * 1440;
var hours = Math.floor(minutes / 60);
minutes -= hours * 60;
return days + 'd ' + hours + 'h ' + minutes + 'm';
})(input)

I use the same javascript to transform a mqtt input and this gives me wanted result but I cannot get it done using a channel input.
I tried this

String CPU_Uptime_ST "CPU Uptime [%s]" (gSI) {channel="systeminfo:computer:openHAB2:cpu#uptime:JS(uptime.js)" }

but it doesn’t work, any ideas please?

-ben

I think you will have to create a Proxy Item and a rule to apply your JS transform to updates to the CPU_Uptime_ST and apply the result to your proxy Item.