How to format time to duration of time in user input for dataset collection

@alan33921 Yes it does make sense, I thought that you’re using one field to collect the time, and my example was written based on this assumption, but if that’s the case, yes you need to get the value in seconds, store it (in seconds) - which I already explained above - then convert it to the format you want (hh:mm). Here’s how.

In the repeater’s onItemReady() function:

$w('#repeater').onItemReady(($item, data) => {
    let time = data.time;
    let sec = time % 60
    let min = ((time-sec) % (60 * 60)) / 60;
    let hr = (time - sec - (min*60)) / (60 * 60);
    
    // then display it as you want, for example...
    $item('#time').text = `${hr}:${min}`;
    
    // And if you want to add the seconds you can too..
    $item('#time').text = `${hr}:${min}:${sec}`;
})

Hope this helps~!
Ahmad