Skip to content

[scheduler] Throw on invalid event dates instead of emitting NaN timestamps#22740

Merged
rita-codes merged 7 commits into
mui:masterfrom
rita-codes:22734-scheduler-invalid-event-dates-are-processed-silently-as-nan-timestamps
Jun 12, 2026
Merged

[scheduler] Throw on invalid event dates instead of emitting NaN timestamps#22740
rita-codes merged 7 commits into
mui:masterfrom
rita-codes:22734-scheduler-invalid-event-dates-are-processed-silently-as-nan-timestamps

Conversation

@rita-codes

@rita-codes rita-codes commented Jun 10, 2026

Copy link
Copy Markdown
Member

Closes #22734

The problem

When an event has a malformed start or end date, the value flows through the entire processing pipeline without validation. adapter.date(value) is never checked with adapter.isValid(), so processDate ends up emitting timestamp: NaN.

A NaN timestamp silently corrupts sorting, positioning, and overlap calculations. The affected events either vanish from the view or render in absurd positions, with no error or warning to indicate what went wrong.

The fix

resolveEventDate now validates the resolved date with adapter.isValid() and throws a descriptive MUI X Scheduler: error naming the offending event id and the invalid value, so the problem surfaces immediately instead of corrupting downstream calculations.

MUI X Scheduler: The date "not-a-date" of event "event-1" is not a valid date.
Invalid dates produce a NaN timestamp that silently breaks sorting, positioning, and overlap calculations.
Provide a valid ISO 8601 date string (for example "2025-01-01T09:00:00" or "2025-01-01T09:00:00Z").

The eventId argument is optional so the internal callers that resolve dates without an event in scope (e.g. rrule.until, test builders) keep working — the pipeline path (start/end/exDates) always supplies it.

…stamps

Malformed `start`/`end`/`exDates` strings flowed through the whole
pipeline without validation, producing a `timestamp: NaN` that silently
corrupted sorting, positioning, and overlap calculations. Events would
vanish or render in absurd positions with no hint of what went wrong.

`resolveEventDate` now validates the resolved date with `adapter.isValid()`
and throws a descriptive `MUI X Scheduler:` error naming the offending
event id and value, so the problem surfaces immediately.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
@rita-codes rita-codes self-assigned this Jun 10, 2026
@rita-codes rita-codes added type: enhancement It’s an improvement, but we can’t make up our mind whether it's a bug fix or a new feature. scope: scheduler Changes related to the scheduler. labels Jun 10, 2026
@rita-codes
rita-codes requested a review from noraleonte June 10, 2026 16:20
Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
@code-infra-dashboard

code-infra-dashboard Bot commented Jun 10, 2026

Copy link
Copy Markdown

Deploy preview

https://deploy-preview-22740--material-ui-x.netlify.app/

Bundle size

Bundle Parsed size Gzip size
@mui/x-data-grid 0B(0.00%) 0B(0.00%)
@mui/x-data-grid-pro 0B(0.00%) 0B(0.00%)
@mui/x-data-grid-premium 0B(0.00%) 0B(0.00%)
@mui/x-charts 0B(0.00%) 0B(0.00%)
@mui/x-charts-pro 0B(0.00%) 0B(0.00%)
@mui/x-charts-premium 0B(0.00%) 0B(0.00%)
@mui/x-date-pickers 0B(0.00%) 0B(0.00%)
@mui/x-date-pickers-pro 0B(0.00%) 0B(0.00%)
@mui/x-tree-view 0B(0.00%) 0B(0.00%)
@mui/x-tree-view-pro 0B(0.00%) 0B(0.00%)
@mui/x-license 0B(0.00%) 0B(0.00%)

Details of bundle changes


Check out the code infra dashboard for more information about this PR.

@noraleonte noraleonte left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks for fixing this! 🎉

@rita-codes
rita-codes enabled auto-merge (squash) June 12, 2026 09:44
@rita-codes
rita-codes disabled auto-merge June 12, 2026 13:04
@rita-codes
rita-codes merged commit 9f8ccf6 into mui:master Jun 12, 2026
21 checks passed
mbrookes pushed a commit to mbrookes/mui-x that referenced this pull request Jun 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

scope: scheduler Changes related to the scheduler. type: enhancement It’s an improvement, but we can’t make up our mind whether it's a bug fix or a new feature.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[scheduler] Invalid event dates are processed silently as NaN timestamps

2 participants