fix(list): include full end day in 'Assigned on' between filter - #3597
fix(list): include full end day in 'Assigned on' between filter#3597amaanJvd wants to merge 1 commit into
Conversation
apply_datetime_filter's `between` branch bounded a Datetime column
(ToDo.creation) with the raw date values, so a date-only upper bound
like "2026-07-02" was treated as 2026-07-02 00:00:00. Any ToDo created
on the end day after midnight was excluded, and selecting a single day
(start == end) returned nothing.
Normalize the bounds to the start and end of the day, mirroring the
sibling `timespan` branch which already does this ("convert to datetime
to include full start and end day"). This is reached from the
"Assigned on" list filter (a Date field offering the Between operator)
via handle_assigned_on_filter.
Same date-Between-returns-nothing class as frappe#3518. Refs frappe#3518.
|
Tick the box to add this pull request to the merge queue (same as
|
Confidence Score: 4/5Safe to merge; the core fix is correct and the only gap is a microsecond edge case on the upper bound. The helpdesk/api/doc.py — the Reviews (1): Last reviewed commit: "fix(list): include full end day in 'Assi..." | Re-trigger Greptile |
| # "2026-07-02" is treated as 2026-07-02 00:00:00 and drops everything | ||
| # on the end day (and returns nothing when start and end are equal). | ||
| start_dt = get_datetime(str(value[0])).replace(hour=0, minute=0, second=0) | ||
| end_dt = get_datetime(str(value[1])).replace(hour=23, minute=59, second=59) |
There was a problem hiding this comment.
Using
second=59 without setting microsecond=0 leaves sub-second timestamps (e.g. 23:59:59.500) potentially excluded if get_datetime ever returns a datetime with microseconds. Add microsecond=999999 to reliably cover the full end day.
| end_dt = get_datetime(str(value[1])).replace(hour=23, minute=59, second=59) | |
| end_dt = get_datetime(str(value[1])).replace(hour=23, minute=59, second=59, microsecond=999999) |
Summary
The
betweenoperator inapply_datetime_filterbounded a Datetime column with the raw filter values, so a date-only upper bound was treated as midnight. This drops results on the end day and returns nothing for a single-day range.helpdesk/api/doc.py:The sibling
timespanbranch already normalizes to the full start/end day ("convert to datetime to include full start and end day"); thebetweenbranch does not.Where it bites
__assigned_on(label "Assigned on") is a filterable Date field, so the list UI offers the Between operator. Its value flows throughhandle_assigned_on_filter→apply_datetime_filter(query, ToDo.creation, ["between", [start, end]]). BecauseToDo.creationis a Datetime column:field <= "2026-07-02"means<= 2026-07-02 00:00:00, so anything assigned that day after midnight is excluded; and>= 2026-07-02 00:00:00 AND <= 2026-07-02 00:00:00, matching only the exact-midnight instant — effectively no results.Fix
Normalize the bounds to the start and end of the day, mirroring the
timespanbranch:Relationship to #3518
This is the same "date Between returns no results" class reported in #3518. Note #3518 is specifically about "Created On", which filters through
frappe.get_listdirectly (a different path that normalizes datetimebetweenbounds itself), so this change does not by itself close #3518 — but it fixes the same failure mode on the "Assigned on" filter, which is entirely helpdesk-side. Cross-referencing for context.Verification
I don't have a bench site to run the integration suite, so this is verified by inspection: the change mirrors the existing, already-shipped normalization in the
timespanbranch of the same function. Happy to add a unit test forapply_datetime_filterif you'd like one.