From de5c36fece49ed57f24397fd97f582d3fcb57ec9 Mon Sep 17 00:00:00 2001 From: alok chando Date: Tue, 5 May 2026 10:32:49 +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 | 16 +++++++++++++++- 1 file changed, 15 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..46e944f63db6 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,21 @@ 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() ); + + var resetDate; + var time; + + if ( typeof info.reset === 'number' ) { + resetDate = new Date( info.reset * 1000 ); + time = resetDate.getTime(); + + debug( + 'Rate limit reset: %s', + ( isNaN( time ) ? 'invalid timestamp' : resetDate.toISOString() ) + ); + } else { + debug( 'Rate limit reset: not provided' ); + } if ( error ) { return clbk( error, info );