fix: validate endDate with formatToICSDate in generateOutlookLink to prevent RangeError crash on invalid date strings#8911
Open
akhilmodi29 wants to merge 1 commit into
Conversation
… prevent RangeError crash on invalid date strings
Contributor
|
@akhilmodi29 is attempting to deploy a commit to the sandeepvashishtha's projects Team on Vercel. A member of the Team first needs to authorize it. |
There was a problem hiding this comment.
Our agent can fix these. Install it.
Gates Passed
4 Quality Gates Passed
Quality Gate Profile: Clean Code Collective
Install CodeScene MCP: safeguard and uplift AI-generated code. Catch issues early with our IDE extension and CLI tool.
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.
Summary
Fixes generateOutlookLink in calendarExporter.js crashing with RangeError
when endDate is an invalid date string, by aligning it with the safe
formatToICSDate validation pattern used by all other link generators.
Problem
generateOutlookLink called new Date(endDate).toISOString() directly
without validation. Invalid date strings produce Invalid Date objects
whose .toISOString() throws RangeError. generateGoogleCalendarLink
and generateYahooCalendarLink both use formatToICSDate which safely
returns null for invalid dates — generateOutlookLink was inconsistent.
Fix
I used formatToICSDate(endDate) to validate the end date before calling
.toISOString(). Falls back to the 2-hour default duration when
formatToICSDate returns null for missing or invalid endDate values.
generateOutlookLink now matches the defensive pattern of its siblings.
Changes
in generateOutlookLink with 2-hour fallback for invalid values
Closes #8910