Skip to content

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

Open
rita-codes wants to merge 3 commits into
mui:masterfrom
rita-codes:22734-scheduler-invalid-event-dates-are-processed-silently-as-nan-timestamps
Open

[scheduler] Throw on invalid event dates instead of emitting NaN timestamps#22740
rita-codes wants to merge 3 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) <noreply@anthropic.com>
@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) <noreply@anthropic.com>
@code-infra-dashboard

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.

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

1 participant