ndresx / react-countdown

A customizable countdown component for React.
MIT License
746 stars 69 forks source link

How to avoid timeout if user set fast time than countdown time? #251

Closed simonho1025 closed 5 months ago

simonho1025 commented 9 months ago

I set the countdown timer(unix timestamp) from server and react-countdown seems using Date.now() to compare the countdown timer. But user can set different time, like slow/ fast time than countdown time that made the timer resume or timeout.

How can I to avoid this issue?

ndresx commented 5 months ago

Hello, I'm not sure what you were trying to achieve there, but you can provide your own interpretation of now via the same-named prop, https://github.com/ndresx/react-countdown?tab=readme-ov-file#now, which is then used instead of Date.now.