-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Inconsistent Behavior in PrimeReact DataTable Filters for "Date is before" and "Date is after" #7543
Comments
@the-pratik you can see the code is properly doing primereact/components/lib/api/FilterService.js Lines 241 to 263 in b7fab09
If I had to guess the underlying |
When I debug its exactly what I see here is Date Before and After in code
Notice one is 20:00:00 mightnight in my timezone with UTC (offset) and the other is 00:00:00 midnight in my timezone (no offset) Date Sat Sep 12 2015 20:00:00 GMT-0400 (Eastern Daylight Time) IS BEFORE Date Sat Sep 12 2015 00:00:00 GMT-0400 (Eastern Daylight Time) = FALSE Date Sat Sep 12 2015 20:00:00 GMT-0400 (Eastern Daylight Time) IS AFTER Date Sat Sep 12 2015 00:00:00 GMT-0400 (Eastern Daylight Time) = TRUE |
The reason is the Showcase is converting JSON |
I see, need to consider time as well when comparing the two dates. Thanks for your explanation and help! |
Yep i try not to use STrings in my JSON for dates I always make it a full timestamp or Date object or Epoch Long. It can never be wrong then! Even if you mean a simple date like |
Yes I'll keep in mind. Thanks! |
Describe the bug
When using the filtering feature in PrimeReact's DataTable, there is an inconsistency in how the "Date is before" and "Date is after" conditions handle the selected date:
"Date is before" Filter:
The filter excludes the selected date.
For example, if the selected date is 09/15/2020, the filter only shows rows with dates before 09/15/2020 (i.e., 09/14/2020 and earlier).
"Date is after" Filter:
The filter includes the selected date.
For example, if the selected date is 09/15/2020, the filter shows rows with dates on or after 09/15/2020 (i.e., including 09/15/2020).
This inconsistency in handling inclusivity can confuse users, as they might expect both filters to either include or exclude the selected date consistently.
Reproducer
https://stackblitz.com/edit/vitejs-vite-y5nolsku?file=src%2FAdvancedDataTable.jsx
System Information
Steps to reproduce the behavior
Expected behavior
Both "Date is before" and "Date is after" filters should handle the selected date consistently.
For example:
If "Date is before" excludes the selected date, then "Date is after" should also exclude it.
Alternatively, if one includes the selected date, the other should include it as well.
Current Behavior:
"Date is before" excludes the selected date.
"Date is after" includes the selected date.
The text was updated successfully, but these errors were encountered: