Fix problem caused by PR #248 - startAt set in future with interval #249
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.
My previous pull request #248 did not take into account if
startAt
was in the future, as it would calculate the previous run as thestartAt
, which would cause thenextRun
to appear to be in the future.For this I sincerely apologize.
The fix for this is simply to check if the
startAt
is in the future. If this is the case, the previous run is not calculated.Since including the
if
statement put the complexity of the_next
function over 22, runningnpm run test:lint
failed.The solution to this was just to create a new function
_calculatePreviousRun
that will calculate the previous run only ifstartAt
is in the past.I also added a test in
test/node/js/src/suites/options.cjs
to prove that this was working.