Skip to content

[data grid] Grid crashes when grouping by date column using valueGetter #18547

@BiserZIvanov

Description

@BiserZIvanov

Steps to reproduce

Steps:

  1. Open this link to live example: live demo
  2. Group by the dateCreated column.
  3. Then group by the company column.
  4. Expand any grouped row.

Current behavior

App crashes with the following error:
MUI X: datecolumn type only acceptsDateobjects as values. UsevalueGetterto transform the value into aDate object. Row ID: auto-generated-row-dateCreated/Wed Jan 12 2022 18:36:23 GMT+0200 (Eastern European Standard Time)-company/20th Century Fox, field: "dateCreated".

Expected behavior

Grouped rows expand normally.

Context

I'm building a data grid that groups rows by multiple columns, including a date field. The date field is stored as an ISO string in the dataset and is converted to a Date object using a valueGetter, as recommended for type: "date" columns. However, when grouping by this date column, the grid crashes due to the grouping logic not respecting the valueGetter result. I'm trying to implement hierarchical grouping (e.g., Date → Company) without needing to mutate the original data or duplicate values.

Your environment

npx @mui/envinfo

Reproduced in CodeSandbox: https://codesandbox.io/p/sandbox/z24lgh

Environment Info:

  • OS: CodeSandbox (cloud)
  • Browser: Tested in Chrome 137
  • @mui/material: 7.1.2
  • @mui/x-data-grid-premium: 8.5.3
  • react: 18.2.0

Search keywords: DataGridPremium, rowGrouping, group by date, valueGetter, type: date, Date object error, MUI X, column grouping, crash on expand, auto-generated-row

Order ID: 96739

Metadata

Metadata

Assignees

No one assigned

    Labels

    feature: Row groupingRelated to the data grid Row grouping featurescope: data gridChanges related to the data grid.support: premium standardSupport request from a Premium standard plan user. https://mui.com/legal/technical-support-sla.type: bugIt doesn't behave as expected.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions