25+5 Clock Works like example, fails 9-15

Using Bravo as browser. Here is the codepen.

[type or paste code here](https://codepen.io/elmobros/pen/JoYKRgN)

https://codepen.io/elmobros/pen/JoYKRgN
I scowered many other topics here.

I think more direction is needed to this project. Can’t tell what is wrong. Passes 22/29.

Please help. Still looking at this in the meantime. Thank you.

1 Like

using react 16 but no redux here

1 Like

Can you post a link to the project you are working on? (instructions etc.)

Is that Brave browser?

1 Like

yes, bravo, should be the link in the post above too

https://codepen.io/elmobros/pen/JoYKRgN

that’s the project link, my bad

Here are some basic troubleshooting steps you can follow. Focus on one test at a time:

  • What is the requirement of the first failing test?
  • Double check the related User Story and ensure it’s followed precisely.
  • What line of code is involved?
  • What is the result of the code and does it match the requirement? You can write the value of a variable to the console at that point in the code to check if needed.
  • Is there any other output or messages in the console to follow up on?

Regarding the first test:

  1. If the timer is running, the element with the id of “time-left” should display the remaining time in mm:ss format (decrementing by a value of 1 and updating the display every 1000ms).

25 + 5 clock has started but time displayed is not changing : expected +0 to be above +0

When I first click the play/pause button there seems to be a large delay before it starts counting down. Can you confirm this? I’m using Firefox but I do get the same test results as you.

it does seem like there is a longer than usual delay.
found a class that should be className due to using jsx rendering line 243 in one of my icons. didn’t change a thing.

i logged +new Date() in my startStop function, the beginning of the countDown function and at the end after the setInterval() within countDown() . doesn’t change at all down to the millisecond unless some how i am getting my timestamp declarations wrong.

Can you show me what you mean?

I find things like that very difficult with React in any case with how the rendering works.

maybe .

so i am putting in

console.log(${+new Date()} + countdown start);

in my startStop() function and two in the countDown() function. when i click the play/pause button (it’s just one button for start and stop), onClick event handler calls startStop() to run which calls countDown(). probably don’t need that but anyway…

I am not seeing any differences in the times from +new Date(). So, not sure why there is a possible delay like you’re saying.

Right now, I am playing around with either interpolating the state properties in the render section e.g.

{this.state.minutes}
, or use DOM directly in the event function handler, e.g. get.ElementById(“time-left”).innerHTML. b/c in #9, it said display was not changing.

no luck yet

didn’t seem to like using DOM and innerHTML. only 17/29 passed

Edit: now the issue is #12-15.


Getting closer. Because the use of setInterval and converting that to minutes and seconds is slightly inaccurate down to the milliseconds, I had added an int value of 2 when setting the Minutes. Changed it to 1. Now 25/29.

s.setMinutes(min+s.getMinutes(),1+s.getSeconds() + parseInt(this.state.seconds),s.getMilliseconds());

Error is

“Timer has not changed”

for all 12-15. Right now, I’m not able to pinpoint how or why this is so.

Edit: Quick question: Is the timer supposed to switch back and forth between session and break? e.g. start a session, get to zero, then break countdown, get to zero time and then a session countdown again?

I hope this is it. Instructions sounded strange regarding the timer’s desired operation.

Just FYI for anyone reading,

I recommend only using setInterval(). Do not use setTimeout. A different thread mentions this. Makes sense because there seems to be a lot of error in milliseconds to make sure setInterval() ends within milliseconds compared to setTimeout().