Skip to content

[Listing] Fix date filter "Between" and Unix-timestamp columns#1946

Open
wwidergoldpimcore wants to merge 1 commit into
2026.2from
bugfix/listing-datefilter-1924-1937
Open

[Listing] Fix date filter "Between" and Unix-timestamp columns#1946
wwidergoldpimcore wants to merge 1 commit into
2026.2from
bugfix/listing-datefilter-1924-1937

Conversation

@wwidergoldpimcore

Copy link
Copy Markdown
Contributor

Changes in this pull request

Resolves #1924
Resolves #1937

Both bugs live in the shared Listing/Filter/DateFilter, used by the notifications, recycle-bin (and other) listings.

  • [Notifications] "Between" Date Filter operator doesn't work #1924 — Notifications "Between" returns empty. The bind parameter name was derived from the column key, so two conditions on the same column collided. The UI sends a "Between" range as two columnFilters (from + to) on the same key (creationDate); both bound to :creationDate, the second overwrote the first, and the query collapsed to creationDate >= to AND creationDate <= to → always empty. This is the same class as [Notes] "Between" Date Filter operator doesn't work #1923. Bind parameters are now indexed per applied filter (:filter_0/:filter_1, :minTime_0/:maxTime_0).

  • [Recycle Bin] Date Filter operators don't work #1937 — Recycle bin date filters don't work (all operators). In addition to the collision above, the filter always compared against a Carbon datetime string ('2024-06-10 00:00:00'), but recyclebin.date is an int(11) unsigned Unix timestamp. MySQL coerced the string to a number, so even "On" returned an empty list. Columns that store a Unix timestamp are now compared against an integer timestamp.

Why a class-keyed map for the timestamp columns

The generic DateFilter has no reliable way to learn a column's storage type: the frontend sends a generic date type, listings expose no table-name accessor (the recycle-bin Dao hardcodes FROM recyclebin in raw SQL), and per-request schema introspection would be heavy and fragile. The storage format is a fixed, domain-specific fact, so it's encoded explicitly as UNIX_TIMESTAMP_COLUMNS (listing class → column keys). Notifications (creationDate is a TIMESTAMP) keeps the datetime-string path and is unaffected.

Additional info

  • Regression tests added to DateFilterTest for the "Between" collision and the Unix-timestamp column; verified they fail without the fix. Full unit suite passes (446 tests), PHPStan clean.
  • Follow-up (studio-ui-bundle): the recycle-bin date filter column is currently commented out with a TODO referencing [Recycle Bin] Date Filter operators don't work #1937 (recycle-bin/filters/filters.tsx). It should be re-enabled once this lands.
  • Separate from [Notes] Fix "Between" date filter and user search #1945 (Notes FilterService), which is a different filter implementation.

…#1937)

The shared Listing/Filter/DateFilter is used by the notifications and recycle-bin
listings (among others). Two bugs made date filtering return wrong results:

- The bind parameter name was derived from the column key, so two conditions on
  the same column collided. The UI sends a "Between" range as two conditions
  (`from` + `to`) on the same key, so the second value overwrote the first and the
  query collapsed to `col >= to AND col <= to` -> always empty. Bind parameters are
  now indexed per applied filter. Fixed #1924 (and the "Between" case for recycle
  bin in #1937).

- The filter always compared against a Carbon datetime string, but the recycle-bin
  `date` column stores a Unix timestamp (int). MySQL coerced the string to a number,
  so every operator (including "On") returned an empty list. Columns that store a
  Unix timestamp are now compared against an integer timestamp. Fixed #1937.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@sonarqubecloud

sonarqubecloud Bot commented Jul 9, 2026

Copy link
Copy Markdown

@wwidergoldpimcore wwidergoldpimcore self-assigned this Jul 9, 2026
@wwidergoldpimcore wwidergoldpimcore added this to the 2026.2.1 milestone Jul 9, 2026
@codacy-production

Copy link
Copy Markdown

Not up to standards ⛔

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

@wwidergoldpimcore wwidergoldpimcore marked this pull request as draft July 9, 2026 15:22
@wwidergoldpimcore wwidergoldpimcore marked this pull request as ready for review July 9, 2026 15:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant