[WEB-8477] fix: created_at/updated_at filters return no work items - #9513
Conversation
Bug 5: filtering the work item list by a creation/update date returned an empty
list. created_at and updated_at are DateTimeFields, but the UI sends a bare
calendar date, and the filterset only exposed `exact` and `range` lookups:
- {"created_at__exact": "2026-07-30"} was coerced to 2026-07-30 00:00:00, so it
matched only rows stamped exactly midnight — effectively never.
- {"created_at__range": "2026-07-28,2026-07-30"} capped the upper bound at
2026-07-30 00:00:00, silently dropping everything created during that final
day (the range only "worked" if you overshot the end date by one day).
Compare the date component instead (`date` / `date__range` via a CSV-parsing
DateCSVRangeFilter), so a calendar date means the whole day and both range
bounds are inclusive. The UI's existing query format is unchanged.
Verified against a local canary build: the exact requests from the bug report
now return 4 and 4 (previously 0 and 0). Adds unit coverage; 6 of the 7 new
tests fail without this change.
Note: `__date` is evaluated in the active timezone, which TimezoneMixin takes
from the user's profile (user_timezone) rather than the browser's timezone, so a
profile/browser timezone mismatch can still shift results by a day. Tracked
separately — not addressed here.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughIssue datetime filters now interpret UI-provided dates as calendar-day values for exact and inclusive range lookups. New unit tests cover ChangesIssue datetime filters
Estimated code review effort: 3 (Moderate) | ~20 minutes Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Linked to Plane Work Item(s) This comment was auto-generated by Plane |
Problem (WEB-8477, Bug 5)
Filtering the work item list by a creation/update date returns no work items.
created_at/updated_atare DateTimeFields, but the UI sends a bare calendar date, and the filterset only exposedexactandrangelookups. Both are wrong for a datetime column:{"created_at__exact":"2026-07-30"}2026-07-30 00:00:00{"created_at__range":"2026-07-28,2026-07-30"}2026-07-30 00:00:00Reproduced from the bug report's exact query strings on a local
canarybuild — both returnedtotal_count: 0with 4 matching work items present.Fix
Compare the date component instead, so a calendar date means the whole day and both range bounds are inclusive:
created_at/created_at__exact→lookup_expr="date"created_at__range→lookup_expr="date__range"via a newDateCSVRangeFilter(BaseCSVFilter+DateFilter) that parses the UI's"a,b"CSV valueupdated_atThe UI's existing query format is unchanged — no frontend change needed.
Verification (local canary build, Django 5.2.15)
created_at__exact=2026-07-30created_at__range=2026-07-28,2026-07-30(report's case)created_at__range=2026-07-30,2026-07-30created_at__exact=2020-01-01(backdated row)created_at__range=2019-01-01,2019-12-31updated_at__exact=2026-07-30Adds
plane/tests/unit/utils/test_issue_datetime_filters.py(7 tests). 6 of the 7 fail without this change (verified by reverting the fix); the 7th is a negative control that passes either way.ruff check+formatclean.Scope notes
filterset.pyis byte-identical onmaster(v1.3.1).FieldError, which fixes WEB-8477 Bugs 2 & 3) or fix(api): filter "Updated At" by updated_at column, not created_at #9323 (the legacyissue_filters.pyupdated_at→created_atcopy-paste bug). This is a third, independent cause.__dateis evaluated in the active timezone, whichTimezoneMixintakes from the user's profile (user_timezone) rather than the browser's timezone. A user whose profile timezone differs from their browser can still see off-by-one-day results (verified: same data returns different rows foruser_timezone=UTCvsAsia/Kolkata). Needs a product decision on which timezone is authoritative, so it's tracked separately.🤖 Generated with Claude Code
Summary by CodeRabbit