Closed fjun99 closed 8 months ago
Great project!
There is a time counting error.
When it is 00:59, the next second will show as 2:00.
When it is 01:59, the next second will show as 4:00.
We may choose to use totalSeconds instead of minutes and seconds.
const [totalSeconds, setTotalSeconds] = useState(0);
useEffect(() => { let interval: NodeJS.Timeout; if (isRunning) { interval = setInterval(() => { setTotalSeconds((prevTotalSeconds) => prevTotalSeconds + 1); }, 1000); } return () => { if (interval) { clearInterval(interval); } }; }, [isRunning]);
function formatTime(time: number): string { return time < 10 ? `0${time}` : `${time}`; } ... {formatTime(Math.floor(totalSeconds / 60))}:{formatTime(totalSeconds % 60)}
A pull request submitted.
notes: NotesGPT at https://usenotesgpt.com/record displays the correct time. However, in a local deployment on a MacBook, I consistently encounter this error.
Great project!
There is a time counting error.
When it is 00:59, the next second will show as 2:00.
When it is 01:59, the next second will show as 4:00.
We may choose to use totalSeconds instead of minutes and seconds.
A pull request submitted.