From b98af77506b52da632ead345912ff0c10f3ab4d5 Mon Sep 17 00:00:00 2001 From: alok chando Date: Tue, 5 May 2026 10:01:46 +0600 Subject: [PATCH] chore: fix JavaScript lint errors (issue #9110) ## Description Fixed a `RangeError: Invalid time value` in `dispatch-workflow/lib/query.js` caused by calling `.toISOString()` on an invalid Date object when `info.reset` is undefined or not a valid number. ## Changes - Added `typeof` check to ensure `info.reset` is a number - Stored `getTime()` result in `time` variable - Used `isNaN()` guard before calling `.toISOString()` ## Related Issues resolves #9110 Signed-off-by: alok chando --- .../_tools/github/dispatch-workflow/lib/query.js | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/lib/node_modules/@stdlib/_tools/github/dispatch-workflow/lib/query.js b/lib/node_modules/@stdlib/_tools/github/dispatch-workflow/lib/query.js index e59357b6b992..e2af0477542e 100644 --- a/lib/node_modules/@stdlib/_tools/github/dispatch-workflow/lib/query.js +++ b/lib/node_modules/@stdlib/_tools/github/dispatch-workflow/lib/query.js @@ -83,7 +83,18 @@ function query( slug, id, options, clbk ) { info = ratelimit( response.headers ); debug( 'Rate limit: %d', info.limit ); debug( 'Rate limit remaining: %d', info.remaining ); - debug( 'Rate limit reset: %s', (new Date( info.reset*1000 )).toISOString() ); + + if ( typeof info.reset === 'number' ) { + var resetTime = new Date( info.reset * 1000 ); + var time = resetTime.getTime(); + + debug( + 'Rate limit reset: %s', + isNaN( time ) ? 'invalid timestamp' : resetTime.toISOString() + ); + } else { + debug( 'Rate limit reset: not provided' ); + } if ( error ) { return clbk( error, info );