View the duration of the stopwatch in USC

As far as I can tell from the documentation we are supposed to format the duration data in GS to get a readable figure. How do I do that with USCs?

Using the Date/Time column to try and format the duration isn’t working as I expected, and the number column of course doesn’t work either.

A side question - what are the uses for having the start time column if data is removed after we stop or pause?

The start time is recorded when you start the stopwatch. This is so the script knows the elapsed time between the current time and when you started the stopwatch. When you pause the stopwatch, then it writes that elapsed value (in number of days) into the duration…so when you start the stopwatch again, it records the new start time and calculates the elapsed time from the new start time to the current time, but also adds the previous duration. They are really used to help the stopwatch script calculate the total elapsed time even when you pause and start the stopwatch multiple times. Stopping the stopwatch clears both values, so the script knows that no time has elapsed.

What exactly are you trying to get out of the duration column? It only holds the value that was elapsed prior to pushing the pause button. It translates to the number of elapsed days where the stopwatch was running prior to pressing pause. How would you expect to display that as a date?

That’s what I suspected. So there is no use for it to the user, it’s just a necessary column we must have in order for it to work?

I was hoping to be able to view the duration without an additional math column in the format you see given in the documentation when formatted in GS. Is that possible?

I guess there could be some visibility benefits to having that column. Basically acting as an on/off indicator.

More or less, yes, it’s correct that they are both work fields for the stopwatch to function properly. You could populate them from outside of the stopwatch component if you had a need to do that for some reason. Also you can use actions to capture those values.

What is your end goal though? What are you trying to show the user? The stopwatch itself shows the duration. Are you trying to save that value to use elsewhere? I guess I’m trying to understand your use case better.

I took a quick peek at the documentation and I’m assuming you want to convert that decimal duration value to a friendly format. I also looked at David’s example app and I feel it not quite a good example. It works fine as long as you pause before submitting the form…but if don’t don’t hit the pause button, the duration will not be populated when you submit the form. If you start the stopwatch, pause it after 5 seconds, wait 5 seconds, the start it again for another 5 seconds…it will show 10 total seconds, but if you submit without pausing, then the form will only save the duration prior to the first pause, which is 5 seconds instead of 10. That’s where it’s important to factor in the start time as well if it’s populated. It’s really important to understand how those two fields work. I think you will need to do some math no matter what, but that all depends on your specific use case first.

1 Like

That answers my question. I appreciate the offer but I don’t need to share my use case.

Thanks!

Also, if you are looking to convert that decimal value to a friendly format, then you can check this out. It’s not a one column or no column solution, but would work without Google sheets. I don’t really trust setting column formats in Google sheets anyway.

If you can capture the start time, current time, and the duration, then you can do the math to get a total duration at the time of capture.

1 Like