{"record":{"id":"19655e10d417123f","repo":"mantinedev/mantine","slug":"mantine-schedule-invalid-start-date-for-event-i","errorCode":null,"errorMessage":"[@mantine/schedule] Invalid start date for event id: ${eventData.id}","messagePattern":"\\[@mantine/schedule\\] Invalid start date for event id: (.+?)","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/@mantine/schedule/src/utils/validate-event/validate-event.ts","lineNumber":6,"sourceCode":"import dayjs from 'dayjs';\nimport { ScheduleEventData } from '../../types';\n\nexport function validateEvent(eventData: ScheduleEventData) {\n  if (!dayjs(eventData.start).isValid()) {\n    throw new Error(`[@mantine/schedule] Invalid start date for event id: ${eventData.id}`);\n  }\n\n  if (!dayjs(eventData.end).isValid()) {\n    throw new Error(`[@mantine/schedule] Invalid end date for event id: ${eventData.id}`);\n  }\n\n  if (dayjs(eventData.end).isBefore(dayjs(eventData.start))) {\n    throw new Error(\n      `[@mantine/schedule] Event end date is before start date for event id: ${eventData.id}`\n    );\n  }\n\n  return eventData;\n}\n","sourceCodeStart":1,"sourceCodeEnd":21,"githubUrl":"https://github.com/mantinedev/mantine/blob/8a284e2c2c53a9cb6f39f5dc389bf41b7a2073f8/packages/@mantine/schedule/src/utils/validate-event/validate-event.ts#L1-L21","documentation":"validateEvent checks every event before it is rendered by any Schedule view (agenda, month, mobile month, week, year). dayjs(event.start).isValid() returns false for unparseable dates, so the event's start cannot be resolved to a real date. The library throws rather than silently dropping or misplacing the event.","triggerScenarios":"event.start is undefined, null, empty string, a non-date string like 'foo', or an invalid Date (new Date('oops')). Happens in every view because all views run validateEvent.","commonSituations":"Backend returning ISO strings with an unexpected format, forgetting to map API fields (using start instead of startDateTime), form submitting before a date was picked, timezone/serialisation stripping the field.","solutions":["Log the failing event by its id and inspect its start value","Normalise dates at the API boundary (e.g. new Date(x) guarded by !Number.isNaN(x.getTime()) or dayjs(x).isValid())","Default or filter out events with missing dates before passing events to the schedule"],"exampleFix":"// before\nevents = apiEvents; // start may be undefined\n\n// after\nconst safeEvents = apiEvents.filter((e) => dayjs(e.start).isValid());","handlingStrategy":"validation","validationCode":"import dayjs from 'dayjs';\n\nconst safeEvents = events.filter((e) => dayjs(e.start).isValid());","typeGuard":"const hasValidStart = (e: ScheduleEventData): boolean => dayjs(e.start).isValid();","tryCatchPattern":null,"preventionTips":["Validate dates at the API boundary before storing","Make start/end required and date-typed in your data model","Log dropped events with their ids to catch upstream data bugs"],"tags":["mantine","schedule","date-validation","dayjs"],"backgroundTag":"invalid-date-input","analyzedSha":"8a284e2c2c53a9cb6f39f5dc389bf41b7a2073f8","analyzedAt":"2026-08-28T10:25:51.087Z","schemaVersion":2},"datasetVersion":"2026-08-28T11:17:15.048Z"}