While not as frustrating as the calculator this project seems to work and it is displaying how it is meant to but it is failing test #8 and I can’t work out why.
- I can see an element with corresponding id=“time-left”.
NOTE: Paused or running, the value in this field should always be displayed in mm:ss format (i.e. 25:00).
Timeout of 2000ms exceeded. For async tests and hooks, ensure “done()” is called; if returning a Promise, ensure it resolves.
Error: Timeout of 2000ms exceeded. For async tests and hooks, ensure “done()” is called; if returning a Promise, ensure it resolves.
at i.g._timeoutError (https://cdn.freecodecamp.org/testable-projects-fcc/v1/bundle.js:598:39286)
at l (https://cdn.freecodecamp.org/testable-projects-fcc/v1/bundle.js:598:37778)
at https://cdn.freecodecamp.org/testable-projects-fcc/v1/bundle.js:598:38751
Here is the timer component and the function that formats the timer variable to display it in the correct way.
Hope someone can help
export default function Timer({timer, sessionState}) {
const displayTimer = () => {
const minutes = (timer / 60) < 10 ?
`0${Math.floor(timer / 60)}` :
Math.floor(timer / 60);
const seconds = (timer % 60) < 10 ?
`0${timer % 60}` :
timer % 60;
return `${minutes}:${seconds}`;
}
return (
<section id="timer">
<h2 id="timer-label">{sessionState}</h2>
<div id="time-left">
{displayTimer()}
</div>
</section>
)
}