25+5 clock MM:SS format

I’m mostly done with the timer, I just have the audio and MM:SS format left to do, but I’m stuck on how to get the MM format to work. I’ve done it with the seconds, but nothing I’ve tried so far has gotten my minutes issue fixed yet. Anyone got any idea on how to go about this? Also, any other feedback on the rest of my code is welcome too.

Here’s the codepen link:

I actually stored the time left entirely in seconds, and used a function to convert second (int) to MM:SS (string) at render. This meant I can skip a check to see if seconds were about to go under 0, and setting a state (minute) dependent on another (second) which can sometimes lead to issues.

I might have to eventually do that if I can’t figure out how to do it with the setInterval method. I’m thinking about creating another interval that deals only with minutes, so I guess I’ll see if that works.

Nevermind, I figured it out, if I edit it directly in the return statement and conditionally render it, it fixes the issue. Thanks for the help anyway!

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.