Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DataTable: Multiple sorting with Date field as first sort #3284

Closed
BearsPunch opened this issue Sep 10, 2022 · 1 comment · Fixed by #3286
Closed

DataTable: Multiple sorting with Date field as first sort #3284

BearsPunch opened this issue Sep 10, 2022 · 1 comment · Fixed by #3286
Assignees
Labels
Type: Bug Issue contains a defect related to a specific component.
Milestone

Comments

@BearsPunch
Copy link

BearsPunch commented Sep 10, 2022

Describe the bug

DataTable doesn't sort dates correctly. Two completely identical dates are different for table and this bug causes another bug, when you try to sort multiple columns and use date column as primary. Every next column with lower sort priority after date column will not be sorted correctly.
Added codesandbox with example. Just select Year column as primary sort and try to sort Color column as second column. You will not be able to sort cars with date "21.05.1995" by color alphabetically, because table see these three dates as different.

Reproducer

https://codesandbox.io/s/primereact-test-forked-4lf1ll?file=/src/table.js

PrimeReact version

8.5.0

React version

18.x

Language

ALL

Build / Runtime

Create React App (CRA)

Browser(s)

No response

Steps to reproduce the behavior

  1. Create DataTable with multisort mode
  2. Set data with date column and set some rows with the same date, but different any second column values
  3. Select date column as primary and try to sort any another column

Expected behavior

DateTable understand the same dates and correctly sort another column in multisort mode

@BearsPunch BearsPunch added the Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible label Sep 10, 2022
@melloware
Copy link
Member

Excellent reproducer! This is a strange one I have to debug.

@melloware melloware added Type: Bug Issue contains a defect related to a specific component. and removed Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible labels Sep 11, 2022
@melloware melloware changed the title Component: DataTable Incorrect date sort DataTable: Multiple sorting with Date field as first sort Sep 11, 2022
melloware added a commit to melloware/primereact that referenced this issue Sep 11, 2022
@melloware melloware self-assigned this Sep 11, 2022
@melloware melloware added this to the 8.6.0 milestone Sep 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug Issue contains a defect related to a specific component.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants