Repository navigation
fix: ignore non-Date argument in useStopwatch reset - #145
Merged
Merged
Conversation
Owner
|
Thank you for your PR, can you please remove both lock files. the diff should contain only useStopwatch.ts and useStopwatch.test.ts |
Signed-off-by: Sai Asish Y <say.apm35@gmail.com>
SAY-5
force-pushed
the
fix-stopwatch-reset-nondate
branch
from
October 5, 2026 19:06
c5e1d45 to
1eac02c
Compare
Contributor
Author
|
Removed both lock files, the diff is now just useStopwatch.ts and the test. |
amrlabib
approved these changes
Oct 5, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The README shows
resetbeing passed straight to an event handler (<button onClick={reset}>Reset</button>), but doing that passes the click event into theoffsetparameter.resetthen hands it toTime.getMillisecondsFromExpiry, which calls.getTime()on it and throwsTypeError: getTime is not a function(#142).This guards the offset with
instanceof Dateso a non-Date argument is treated as no offset, matching the documented usage. Added a regression test that callsresetwith an event-like object.