I have a query that returns a list of jobs. Each job has a start and end timestamp. I want to calculate the total number of hours between each start and end timestamp. I think my JS is correct but I'm struggling on figuring out where to actually put this JS. Since I'm actually doing a calculation and returning a value, it doesn't seem like I can just put {{ my code }} in the Value: field of the component that's supposed to display the number.
let hours = 0;
for (let i = 0; i < {{showJobs.data.length}}; i++){
hours = hours + (Math.abs({{showJobs.data.job_start[i]}} - {{showJobs.data.job_end[i]}}) / 36e5);
return hours;
}