Skip to content

Commit

Permalink
fix(useCountdown): Ensure "until" is in the future
Browse files Browse the repository at this point in the history
  • Loading branch information
peterjuras committed Aug 2, 2019
1 parent 92811a4 commit 1995cfa
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/use-countdown.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export function useCountdown(
}

useEffect((): (() => void) | void => {
if (timeLeft.current > 0) {
if (Date.now() < usableConfig.until) {
return timeSync.createCountdown((newTimeLeft): void => {
timeLeft.current = newTimeLeft;
forceUpdate();
Expand Down

0 comments on commit 1995cfa

Please sign in to comment.