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 #11918

Closed
BearsPunch opened this issue Sep 11, 2022 · 2 comments · Fixed by #12004
Closed

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

BearsPunch opened this issue Sep 11, 2022 · 2 comments · Fixed by #12004
Assignees
Labels
Type: Bug Issue contains a bug related to a specific component. Something about the component is not working
Milestone

Comments

@BearsPunch
Copy link

Describe the bug

The same issue what Primereact had. link to the issue
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 stackblitz 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 dates as different.
As I see, issue in function

multisortField(data1, data2, multiSortMeta, index) {
...
if (value1 == value2)
}

Dates should be compared in another way

Environment

Just new angular project with added primeng lib

Reproducer

https://stackblitz.com/edit/github-zpj9hk-hkrmgz

Angular version

14.2.0

PrimeNG version

14.0.2

Build / Runtime

Angular CLI App

Language

ALL

Node version (for AoT issues node --version)

16.13.1

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

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

@BearsPunch BearsPunch added the Type: Bug Issue contains a bug related to a specific component. Something about the component is not working label Sep 11, 2022
@julian-scholz
Copy link

I recently experienced the same issue 👍🏼

@BearsPunch
Copy link
Author

really? no one cares about so important bug?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug Issue contains a bug related to a specific component. Something about the component is not working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants