Skip to content

Bug: Executions date-range filter excludes the entire end day (UTC-midnight collapse) — "Today" returns no rows #2075

Closed

Description

@yannickmonney

Area / route

Automations -> a workflow -> Executions sub-tab. Route: /dashboard/$id/automations/$amId/executions.

Steps to reproduce

  1. Open the Executions sub-tab of any workflow that has at least one run today (after 00:00 UTC).
  2. Open the date-range filter and choose a preset such as "Today" or "Last 7 days".
  3. Observe the resulting table.

Expected

  • "Today" returns runs that happened today.
  • "Last 7 / 14 / 30 days" (and any range whose end date is today) include today's runs.
  • More generally, executions that ran on the chosen end date appear, regardless of the time of day they ran.

Actual

The entire end day is excluded:

  • "Today" returns essentially zero rows (only a run at exactly 00:00:00.000 UTC could match).
  • Every range preset silently drops today's runs.

Root cause is a date-to-timestamp collapse with no end-of-day handling and a local-vs-UTC mismatch:

  • The presets set to = startOfDay(today) in local time.
  • The table serializes to as a bare date string: formatISO(range.to, { representation: 'date' }) -> e.g. "2026-06-24". No end-of-day adjustment.
  • The backend does toDate = new Date("2026-06-24").getTime(), which JS parses as UTC midnight (2026-06-24T00:00:00.000Z), then filters with .lte('startedAt', toDate).
  • wfExecutions.startedAt is a numeric epoch timestamp, so any run at a time > 00:00 UTC on the end day has startedAt > toDate and fails the predicate.

Confirmed by computation: new Date('2026-06-24').getTime() = 1782259200000 (UTC midnight); a run at 2026-06-24T07:30:00Z = 1782286200000; 1782286200000 <= 1782259200000 is false, so the run is excluded.

A secondary skew exists because the picker computes startOfDay in local time while the backend interprets the serialized date as UTC; in non-UTC timezones this shifts the boundary further.

Evidence (confirmed file:line)

  • services/platform/app/components/ui/forms/date-range-picker.tsx:60-82 — getPresetDateRange returns to: startOfDay(today) (local midnight) for every range/today preset.
  • services/platform/app/features/automations/executions/executions-table.tsx:372-377 — handleDateRangeChange serializes to via formatISO(range.to, { representation: 'date' }), producing a bare YYYY-MM-DD with no end-of-day adjustment.
  • services/platform/app/routes/dashboard/$id/automations/$amId/executions.tsx:13,39 and services/platform/app/features/automations/hooks/queries.ts:52-67 — dateTo is passed through unchanged.
  • services/platform/convex/workflow_executions/queries.ts:102-114 — listExecutions forwards args directly to the helper.
  • services/platform/convex/workflows/executions/list_executions_paginated_native.ts:30,47,61,71 — toDate = new Date(args.dateTo).getTime() (UTC midnight) and .lte('startedAt', toDate) on every index branch.
  • services/platform/convex/workflows/schema.ts:28 — startedAt: v.number() (epoch ms), indexed by_definition_startedAt (line 69).

Notes

  • Fix the end boundary to be inclusive of the whole end day. Two clean options: (a) on serialization, send dateTo as the end-of-day instant (e.g. endOfDay(range.to) -> a full ISO datetime, with the local/UTC convention made explicit and consistent with how dateFrom is interpreted); or (b) in the backend, treat a bare date dateTo as end-of-day by adding 24h - 1ms (or using a strict < against the start of the next day). Whichever is chosen, make the picker's local startOfDay and the backend's parsing agree on a single timezone convention so the dateFrom lower bound and dateTo upper bound are symmetric.
  • The same picker/serialization pattern may be reused by other list filters; if the fix lands in the shared date-range-picker serialization path or a shared backend date-parse helper, audit other consumers for the same off-by-one-day exclusion.

Filed by an automated manual-review pass (live browser QA + a 25-agent code-grounded audit, each finding adversarially verified). Deduped against open issues (incl. #1972–#1999, settings/forms epic #1941–#1966, audit cluster #1842–#1846) and recently-closed issues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    automatedbugpriority: mediumservice: platform

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions