Pomodoro Clock finished for review

Hey guys, I finished my Pomodoro Clock. The main timer is incrementable/decrementable in periods of 1 minute to a max of 50 and the break timer in periods of 5 minutes to a max of 10. When you hit start, the start button should be disabled until stop, reset or the increment/decrement buttons are hit. The timers count down really fast right now for testing purposes.

I found a bug that I can’t seem to solve, when the break timer ticks down to 0 it runs the resetTimer() function which runs the getBreakMinutesSeconds(time) function which passes in the initial break timer amount (by default 300 seconds (5:00) but the display always shows an extra 0 at the end (5:000) if it’s an even minute number (ex: 1:00, 2:00, 5:00, 10:00). This doesn’t happen when the number doesn’t end in 00.

Comments appreciated, including how to possibly refactor the functions. I know it’s ugly code right now as I basically reused all the same code in duplicate functions for the main timer and the break timer. Thanks!

In terms of your bug - in your breakTimer, if seconds === 0, then seconds goes to 59 and minutes decreases by one. Otherwise, it doesn’t have a definition at 0, so it follows the rule described in getBreakTimeMinutesSeconds by adding that third 0. I could be wrong, but if I read the code correctly, you might want to rethink how you wrote that piece.

Anyway, as a functioning app, it works just fine as both the session time and the break time both count down exactly how it’s expected.

A couple nitpicks that I could think of… When the session is complete, I would give the user the power of when to start the break. As you have it right now, the break begins right after the session is complete. It doesn’t give the user a chance to complete a sentence they’re reading in a book or finish a line of code that they’re writing.

Like I said, as a functioning app, it works. As for a user friendly and appealing design, it’s lacking. Give the lines some margin and fix the placements of your increase and decrease buttons, or label which is which.