Skip to content

When sorting on date grouped column of year is not taken into account #4628

Description

@daphnesmit

Describe the bug

I dont know if this is a bug or changed behaviour since v7.

  1. I have a data object value 'caseDate' which is used as row.caseDate.slice(-4) to get the year for the 'year' column.
  2. I have a date column where the same caseDate is formatted as a pretty date and parsed to getTime for sorting in accessorFn.
  3. I have the 'year' column grouped.
  4. If I use the 'date 'column as a default sorting the 'year' grouped column is just sorted as the data comes in instead of also sorted by date because it also uses caseDate. In v7 this was the case and would also order the grouped column.

Your minimal, reproducible example

https://codesandbox.io/s/optimistic-rhodes-2bbzse?file=/src/main.tsx

Steps to reproduce

Just see how the year column is not sorted as the date column.

Expected behavior

I would expect this to work the same as in v7 or a clear explanation why this logic has changed.

How often does this bug happen?

Every time

Screenshots or Videos

No response

Platform

Chrome MacOs

react-table version

v8.7.4

TypeScript version

No response

Additional context

No response

Terms & Code of Conduct

  • I agree to follow this project's Code of Conduct
  • I understand that if my bug cannot be reliable reproduced in a debuggable environment, it will probably not be fixed and this issue may even be closed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions