{"record":{"id":"303c31d841479d39","repo":"mantinedev/mantine","slug":"mantine-schedule-invalid-end-date-for-event-id","errorCode":null,"errorMessage":"[@mantine/schedule] Invalid end date for event id: ${eventData.id}","messagePattern":"\\[@mantine/schedule\\] Invalid end date for event id: (.+?)","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/@mantine/schedule/src/utils/validate-event/validate-event.ts","lineNumber":10,"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 reports that event.end cannot be parsed as a valid date (dayjs(event.end).isValid() === false). Every schedule view validates this before layout. Without a valid end the duration cannot be computed, so the library fails fast.","triggerScenarios":"event.end is undefined/null, an empty string, or an unparseable value like '2024-13-45' or 'N/A'. All-day events created without an explicit end are a frequent cause.","commonSituations":"API omitting end for zero-length events, form where the end-time picker was optional, serialisation turning null into a string 'null'.","solutions":["Inspect the event with the reported id and fix its end value","Set end equal to start for instantaneous events instead of leaving it empty","Normalise/validate events once at the data boundary before rendering"],"exampleFix":"// before\n{ id: '1', start: '2025-01-01', end: undefined }\n\n// after\n{ id: '1', start: '2025-01-01', end: '2025-01-01' }","handlingStrategy":"validation","validationCode":"const safeEvents = events.filter(\n  (e) => dayjs(e.start).isValid() && dayjs(e.end).isValid()\n);","typeGuard":"const hasValidDates = (e: ScheduleEventData): boolean =>\n  dayjs(e.start).isValid() && dayjs(e.end).isValid();","tryCatchPattern":null,"preventionTips":["Default end to start for zero-duration events","Reject form submissions with missing dates","Normalise nulls from the API instead of passing them through"],"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"}