Need help 25 & 5 clock [REACT]

warning beeper is busted, watch your ears
passing 28 of 29 not really sure what I’m doing wrong.
Please help and take a look, it is saying value is 4 when it should be 5.
Using React Component state, I believe I am using prevState where appropriate, but it is failing nonetheless.

  1. When a session countdown reaches zero (NOTE: timer MUST reach 00:00), a new break countdown should begin, counting down from the value currently displayed in the id=“break-length” element.
    Timer has switched to Break time, but it didn’t start with the correct value.: expected 4 to equal 5
    AssertionError: Timer has switched to Break time, but it didn’t start with the correct value.: expected 4 to equal 5
    at Proxy.c (https://cdn.freecodecamp.org/testable-projects-fcc/v1/bundle.js:549:1889)
    at Proxy.l (https://cdn.freecodecamp.org/testable-projects-fcc/v1/bundle.js:431:130)
    at Function.n.strictEqual (https://cdn.freecodecamp.org/testable-projects-fcc/v1/bundle.js:574:655)
    at a. (https://cdn.freecodecamp.org/testable-projects-fcc/v1/bundle.js:657:179426)
    at l (https://cdn.freecodecamp.org/testable-projects-fcc/v1/bundle.js:657:98461)
    at Generator._invoke (https://cdn.freecodecamp.org/testable-projects-fcc/v1/bundle.js:657:98214)
    at Generator.forEach.e. [as next] (https://cdn.freecodecamp.org/testable-projects-fcc/v1/bundle.js:657:98818)
    at r (https://cdn.freecodecamp.org/testable-projects-fcc/v1/bundle.js:1:1054)
    at i (https://cdn.freecodecamp.org/testable-projects-fcc/v1/bundle.js:1:1265)

codepen

Hi @davebowl ,

When the session timer ends and the break timer starts, the timer should start with the set break-length.
In your clock, the break timer starts with break-length -1. So, instead of say 5 :00, it starts with 4:59.
I rushed through your code and feel that maybe, the below line could be the problem.
breakTimer: this.state.breakTimer - 100

Hope it helps.

1 Like

well i think ill need more detail because im just not picking up what your laying down

Hi @davebowl ,

Try the following on your clock:

  1. Set the session length to 1 (break length default value is 5).
  2. Start the timer and wait till it reaches 00:00

Expected output: Display 05:00 next and start the countdown from this point.

But the timer displays 04:59 and starts the countdown.

1 Like

i figured it out added a break Timmer between clocks as it was counting 5 before 0 and 5 switch thank you for your clues i just wasn’t catching that

1 Like

No worries. Glad that the problem is solved :+1:

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