25 + 5 Timer not Formatted correctly?

Tell us what’s happening:
My time-left display is not passing the tests, it is telling me that the time left is not formatted correctly. It also states ‘59’ was expected to be ‘60’
timeleft

I checked the DOM to see exactly how my time-left element looks and the format is always in MM:SS so I’m confused on how it is actually failing the test

any help would be greatly appreciated

codepen

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/100.0.4896.88 Safari/537.36

Challenge: Build a 25 + 5 Clock

Link to the challenge:

I feel silly. This is why I shouldn’t repeat super long variable names lol.
In this part of the code I kept referring to this.state.sessionLength and my error was typing this.sessionLength once.

      case 'session-length': 
        this.setState({
          sessionLength: increment ? this.state.sessionLength < 60 ?
          this.state.sessionLength + 1 : this.state.sessionLength :
          this.state.sessionLength > 1 ?
          this.state.sessionLength - 1 : this.state.sessionLength,
          timeLeft: increment ? this.sessionLength < 60 ?
          (this.state.sessionLength + 1) * 60 : this.state.sessionLength * 60 :
          this.state.sessionLength > 1 ?
          (this.state.sessionLength - 1) * 60 : this.state.sessionLength * 60});
        break;

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