- 
                Notifications
    You must be signed in to change notification settings 
- Fork 116
Open
Description
If I call restart after the timer has already expired, the timer updates to the new Date but it doesn't start counting down.
Simple Example:
const [hasTimeExpired, setHasTimeExpired] = useState(false);
let dt = new Date();
const {
    seconds,
    minutes,
    hours,
    days,
    isRunning,
    start,
    pause,
    resume,
    restart,
} = useTimer({ expiryTimestamp: dt, onExpire: () => setHasTimeExpired(true), autoStart: false });
useEffect(() => {
    let dt = new Date();
    dt.setSeconds(dt.getSeconds() + 15);
    restart(dt, true);
}, [])
useEffect(() => {
    let dt = new Date();
    dt.setSeconds(dt.getSeconds() + 120);
    restart(dt, true);
}, [hasTimeExpired])
return (
    <div className= "Clock-Wrapper">
        <span className="Clock-Time-Front">
            {hours}:{minutes}:{seconds}
        </span>
    </div>
)
Metadata
Metadata
Assignees
Labels
No labels