[scheduler] Throw on invalid event dates instead of emitting NaN timestamps#22740
Open
rita-codes wants to merge 3 commits into
Conversation
…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>
…ocessed-silently-as-nan-timestamps
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Deploy previewhttps://deploy-preview-22740--material-ui-x.netlify.app/ Bundle size
Check out the code infra dashboard for more information about this PR. |
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.
Closes #22734
The problem
When an event has a malformed
startorenddate, the value flows through the entire processing pipeline without validation.adapter.date(value)is never checked withadapter.isValid(), soprocessDateends up emittingtimestamp: NaN.A
NaNtimestamp 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
resolveEventDatenow validates the resolved date withadapter.isValid()and throws a descriptiveMUI X Scheduler:error naming the offending event id and the invalid value, so the problem surfaces immediately instead of corrupting downstream calculations.The
eventIdargument 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.