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: Subheader row group along with date sorting not working as intended #5651

Closed
MilesWinston23 opened this issue Dec 27, 2023 · 2 comments · Fixed by #5660
Closed
Assignees
Labels
Type: Bug Issue contains a defect related to a specific component.
Milestone

Comments

@MilesWinston23
Copy link

MilesWinston23 commented Dec 27, 2023

Describe the bug

I'm using the subheader row grouping prop and grouping by date. Along with that, I also have date filtering going on.

All I see is a bunch of repeating date subheaders instead of just one. I think it may have to do with the grouping being done on Date objects instead of strings, but I'm not sure how to fix that? Any ideas?

Codesandbox: https://codesandbox.io/p/sandbox/primereact-demo-forked-3x9ryj?file=%2Fsrc%2FApp.tsx%3A276%2C24

Reproducer

https://codesandbox.io/p/sandbox/primereact-demo-forked-3x9ryj?file=%2Fsrc%2FApp.tsx%3A276%2C24

PrimeReact version

latest

React version

18.x

Language

TypeScript

Build / Runtime

Vite

Browser(s)

Chrome

Steps to reproduce the behavior

No response

Expected behavior

No response

@MilesWinston23 MilesWinston23 added the Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible label Dec 27, 2023
@melloware
Copy link
Member

Well its because of this: https://www.freecodecamp.org/news/javascript-date-comparison-how-to-compare-dates-in-js/

I have a feeling PR is just doing object equality and date === date will never be equal it has to be date.getTime() === date.getTime()

@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 Dec 29, 2023
@melloware melloware self-assigned this Dec 29, 2023
@melloware melloware added this to the 10.2.2 milestone Dec 29, 2023
melloware added a commit to melloware/primereact that referenced this issue Dec 29, 2023
melloware added a commit to melloware/primereact that referenced this issue Dec 29, 2023
@melloware
Copy link
Member

Great reproducer i was able to debug and fix it!

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