{"record":{"id":"81173d8ce5abb442","repo":"mermaid-js/mermaid","slug":"invalid-date-str","errorCode":null,"errorMessage":"Invalid date:${str}","messagePattern":"Invalid date:(.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/mermaid/src/diagrams/gantt/ganttDb.js","lineNumber":346,"sourceCode":"    return mDate.toDate();\n  } else {\n    log.debug('Invalid date:' + str);\n    log.debug('With date format:' + dateFormat.trim());\n\n    // Timestamp formats can fall back to new Date()\n    const d = new Date(str);\n    if (\n      d === undefined ||\n      isNaN(d.getTime()) ||\n      // WebKit browsers can mis-parse invalid dates to be ridiculously\n      // huge numbers, e.g. new Date('202304') gets parsed as January 1, 202304.\n      // This can cause virtually infinite loops while rendering, so for the\n      // purposes of Gantt charts we'll just treat any date beyond 10,000 AD/BC as\n      // invalid.\n      d.getFullYear() < -10000 ||\n      d.getFullYear() > 10000\n    ) {\n      throw new Error('Invalid date:' + str);\n    }\n    return d;\n  }\n};\n\n/**\n * Parse a string into the args for `dayjs.add()`.\n *\n * The string have to be compound by a value and a shorthand duration unit. For example `5d`\n * represents 5 days.\n *\n * Please be aware that 1 day may be 23 or 25 hours, if the user lives in an area\n * that has daylight savings time (or even 23.5/24.5 hours in Lord Howe Island!)\n *\n * Shorthand unit supported are:\n *\n * - `y` for years\n * - `M` for months","sourceCodeStart":328,"sourceCodeEnd":364,"githubUrl":"https://github.com/mermaid-js/mermaid/blob/d93e9c88c01a599c062ee6a3f1462e3558ac6b90/packages/mermaid/src/diagrams/gantt/ganttDb.js#L328-L364","documentation":"Error \"Invalid date:${str}\" thrown in mermaid-js/mermaid.","triggerScenarios":"Thrown at packages/mermaid/src/diagrams/gantt/ganttDb.js:346 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"d93e9c88c01a599c062ee6a3f1462e3558ac6b90","analyzedAt":"2026-08-12T06:23:11.304Z","schemaVersion":2},"datasetVersion":"2026-08-12T13:17:24.610Z"}