chandup83
(Chandup83)
March 30, 2020, 3:54pm
1
Hi Team,
I am using the filter for date in my application.
Below is the steps I did
Use filter and select Before for Date.
Entered one of the date that is in the grid for before (eg: 05/12/2015)
The filter result contains 05/12/2015 as well even if the filter is “before”.
I am expecting the all data that is before 05/12/2015.
Is this the valid scenario.
Tried the same in https://handsontable.com/docs/7.4.2/demo-filtering.html .
Thanks,
Chandrakanth
Thank you for sharing this issue, @chandup83
you’re right, we should exclude the date as well. I’ve reported the issue on our Github board https://github.com/handsontable/handsontable/issues/6791
and will update you once it is solved.
chandup83
(Chandup83)
March 31, 2020, 12:52pm
3
@aleksandra_budnik , Thanks for the quick response.
Can I know the approximate time it may take for us to get the solution. We are planning for the Production release early next week and this will definitely help us.
Thanks in Advance,
Chandrakanth
We’re preparing beta2 of Handsontable 8.0.0, which solves around 130 issues of the ones reported on our Github board. We would like to publish beta2 next month but there is no deadline (if additional tests much be added the release time will expand).
Within that time we won’t be able to any any additional issues as there are no free developers.
The only workaround I see is to add a custom dropdown menu option but that may take you more than a week.
chandup83
(Chandup83)
March 31, 2020, 1:25pm
5
@aleksandra_budnik Thanks for the response.
Noted and will wait for the release
Thanks,
Chandrakanth
UPDATE: This issue has been fixed in v18:
develop ← feature/DEV-1575_Fix-Date-Filter-Before-After-Exclusive
opened 11:59AM - 30 Apr 26 UTC
### Context
The PR fixes a bug where the `before` and `after` date filter con… ditions include the boundary date in their results. Filtering "before 10/24/2019" currently returns rows with that exact date, which is incorrect. All major spreadsheets and grids (Excel, Google Sheets) treat "before" as strictly less than and "after" as strictly greater than -- the boundary date is never included unless a separate "on or before" / "on or after" option is chosen.
The fix updates the comparison operators from `<=`/`>=` to `<`/`>` in all six affected condition files (`date/before`, `date/after`, `intlDate/before`, `intlDate/after`, `intlTime/before`, `intlTime/after`). The `between`, `intlDate/between`, and `intlTime/between` conditions previously delegated to `before`/`after` internally; they now use direct inclusive comparisons since the shared conditions are no longer inclusive.
**New conditions added for backward compatibility:**
To preserve workflows that relied on the old inclusive behavior, six new conditions have been added:
| Condition key | Label | Cell types |
|---|---|---|
| `date_before_or_equal` | Before or equal to | `date` |
| `date_after_or_equal` | After or equal to | `date` |
| `intl_date_before_or_equal` | Before or equal to | `intl-date` |
| `intl_date_after_or_equal` | After or equal to | `intl-date` |
| `intl_time_before_or_equal` | Before or equal to | `intl-time` |
| `intl_time_after_or_equal` | After or equal to | `intl-time` |
These appear in the filter dropdown after their exclusive counterparts and are available via `plugin.addCondition(col, 'date_before_or_equal', ['2025-01-01'])`. Translations for all 21 supported languages are included.
GitHub issue: https://github.com/handsontable/handsontable/issues/6791
ClickUp task: https://app.clickup.com/t/9015210959/DEV-1575
### How has this been tested?
All existing boundary-date test cases in the six `before`/`after` unit test files were updated from `assumption: true` to `assumption: false` to reflect the correct exclusive behavior. These tests were confirmed to fail before the fix and pass after.
New tests for the six new inclusive conditions:
- Unit tests: `__tests__/condition/date/afterOrEqual.unit.js`, `beforeOrEqual.unit.js`, `intlDate/afterOrEqual.unit.js`, `intlDate/beforeOrEqual.unit.js`, `intlTime/afterOrEqual.unit.js`, `intlTime/beforeOrEqual.unit.js`
- E2E test: `__tests__/condition/date/beforeOrEqualAfterOrEqual.spec.js` -- verifies boundary inclusion, cross-side exclusion, and +1 row count vs exclusive counterpart
The dropdown list assertions in `__tests__/component/conditional.spec.js` were updated to include the new labels.
- Run unit tests: `npm run test:unit --testPathPattern=filters --prefix handsontable`
- Run E2E tests: `npm run test:e2e --testPathPattern=Filters --prefix handsontable`
- Build: `npm run build --prefix handsontable`
### Types of changes
- [x] Bug fix (non-breaking change which fixes an issue)
- [x] New feature or improvement (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
- [x] Additional language file or change to the existing one (translations)
### Related issue(s):
1. DEV-1575
2. https://github.com/handsontable/handsontable/issues/6791
### Affected project(s):
- [x] `handsontable`
- [ ] `@handsontable/angular-wrapper`
- [ ] `@handsontable/react-wrapper`
- [ ] `@handsontable/vue3`
### Checklist:
- [x] I have reviewed the guidelines about [Contributing to Handsontable](https://github.com/handsontable/handsontable/blob/master/CONTRIBUTING.md) and I confirm that my code follows the code style of this project.
- [x] I have signed the [Contributor License Agreement](https://docs.google.com/forms/d/e/1FAIpQLScpMq4swMelvw3-onxC8Jl29m0fVp5hpf7d1yQVklqVjWGA/viewform?c=0&w=1)
- [x] My change requires a change to the documentation.
ClickUp task: https://app.clickup.com/t/9015210959/DEV-1575
---
> [!NOTE]
> **Medium Risk**
> Changes core filtering semantics for `before`/`after` on `date`, `intl-date`, and `intl-time`, which can alter user-visible results; mitigated by adding explicit *or equal* operators and expanding test coverage.
>
> **Overview**
> Fixes a filters bug where `Before`/`After` for `date`, `intl-date`, and `intl-time` incorrectly included the boundary value by making those conditions **exclusive**.
>
> Adds new **inclusive** operators (`*_before_or_equal`, `*_after_or_equal`) to preserve prior behavior, wires them into the condition menus and i18n (new constants + translations), and updates `between` implementations to use direct inclusive comparisons rather than delegating to `before`/`after`.
>
> Updates/extends unit, integration, and visual tests plus docs/changelog to reflect the new operator set and boundary behavior.
>
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit 4ff284496ef3bc3efbb9d7eefc227de317fdcaa1. Bugbot is set up for automated code reviews on this repo. Configure [here](https://www.cursor.com/dashboard/bugbot).</sup>