mermaid-js/mermaid · error · Error

Invalid date:${str}

Error message

Invalid date:${str}

What it means

Error "Invalid date:${str}" thrown in mermaid-js/mermaid.

Source

Thrown at packages/mermaid/src/diagrams/gantt/ganttDb.js:346

    return mDate.toDate();
  } else {
    log.debug('Invalid date:' + str);
    log.debug('With date format:' + dateFormat.trim());

    // Timestamp formats can fall back to new Date()
    const d = new Date(str);
    if (
      d === undefined ||
      isNaN(d.getTime()) ||
      // WebKit browsers can mis-parse invalid dates to be ridiculously
      // huge numbers, e.g. new Date('202304') gets parsed as January 1, 202304.
      // This can cause virtually infinite loops while rendering, so for the
      // purposes of Gantt charts we'll just treat any date beyond 10,000 AD/BC as
      // invalid.
      d.getFullYear() < -10000 ||
      d.getFullYear() > 10000
    ) {
      throw new Error('Invalid date:' + str);
    }
    return d;
  }
};

/**
 * Parse a string into the args for `dayjs.add()`.
 *
 * The string have to be compound by a value and a shorthand duration unit. For example `5d`
 * represents 5 days.
 *
 * Please be aware that 1 day may be 23 or 25 hours, if the user lives in an area
 * that has daylight savings time (or even 23.5/24.5 hours in Lord Howe Island!)
 *
 * Shorthand unit supported are:
 *
 * - `y` for years
 * - `M` for months

View on GitHub (pinned to d93e9c88c0)

When it happens

Trigger: Thrown at packages/mermaid/src/diagrams/gantt/ganttDb.js:346 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of mermaid-js/mermaid@d93e9c88c0 (2026-08-12). Data as JSON: /api/errors/81173d8ce5abb442. Report an issue: GitHub.