Skip to content

fix: validate endDate with formatToICSDate in generateOutlookLink to prevent RangeError crash on invalid date strings#8911

Open
akhilmodi29 wants to merge 1 commit into
SandeepVashishtha:masterfrom
akhilmodi29:fix/calendarexporter-outlook-invalid-enddate-crash
Open

fix: validate endDate with formatToICSDate in generateOutlookLink to prevent RangeError crash on invalid date strings#8911
akhilmodi29 wants to merge 1 commit into
SandeepVashishtha:masterfrom
akhilmodi29:fix/calendarexporter-outlook-invalid-enddate-crash

Conversation

@akhilmodi29

Copy link
Copy Markdown
Contributor

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

  • src/utils/calendarExporter.js — validated endDate via formatToICSDate
    in generateOutlookLink with 2-hour fallback for invalid values

Closes #8910

… prevent RangeError crash on invalid date strings
@vercel

vercel Bot commented Jun 14, 2026

Copy link
Copy Markdown
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.

@github-actions github-actions Bot added the level:beginner 20pts label Jun 14, 2026
@github-actions github-actions Bot added gssoc:approved gssoc approved PR type:bug quality:clean 1.2x bug Something isn't working size/XS Extra-small pull request labels Jun 14, 2026

@codescene-access codescene-access Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working gssoc:approved gssoc approved PR level:beginner 20pts quality:clean 1.2x size/XS Extra-small pull request type:bug

Projects

None yet

1 participant