Skip to content

Bug: Automations executions date-range filter — dateTo excludes all executions on the end date (off-by-one) #2028

Closed

Description

@yannickmonney

Area

Automations → Executions tab → date range filter — services/platform/convex/workflows/executions/list_executions_paginated_native.ts

Steps to reproduce

  1. Open any automation's Executions tab.
  2. Open the date range filter and select a range, e.g. "Last 7 days" (today as dateTo), or pick a specific end date like 2024-01-15.
  3. Executions that started on the end date (at any time after midnight UTC) do not appear in the results.

Expected

Executions that started at any point during the selected end date should be included (i.e. the end date is inclusive, covering the full day 00:00:00 – 23:59:59.999).

Actual

Only executions at exactly 00:00:00.000 UTC on the end date satisfy the lte filter. Any execution that ran during the day (noon, evening, etc.) is excluded. For practical use (most executions do not start at midnight) this means the end date effectively filters to the prior day.

Evidence

services/platform/convex/workflows/executions/list_executions_paginated_native.ts:30

const toDate = args.dateTo ? new Date(args.dateTo).getTime() : undefined;

args.dateTo is a date-only string (YYYY-MM-DD) produced in the frontend by:

// executions-table.tsx:376
formatISO(range.to, { representation: 'date' })

new Date('2024-01-15') parses as 2024-01-15T00:00:00.000Z (UTC midnight). The index filter then does:

.lte('startedAt', toDate)  // midnight; noon execution has startedAt > midnight → excluded

Quick proof:

const toDate = new Date('2024-01-15').getTime();          // 1705276800000 (midnight)
const noonExecution = new Date('2024-01-15T12:00:00Z').getTime(); // 1705320000000
noonExecution > toDate; // true → excluded by lte

The same off-by-one applies to both index branches (by_definition_startedAt and by_definition_triggeredBy_startedAt) at lines 47 and 61.

Notes

Fix: add one day minus one millisecond to the toDate boundary so the full end day is covered:

const toDate = args.dateTo
  ? new Date(args.dateTo).getTime() + 24 * 60 * 60 * 1000 - 1
  : undefined;

or equivalently set time to end-of-day UTC before .getTime().

Activity

  1. added
    priority: medium
    bug
    service: platform
    automated
    on Jun 23, 2026
  2. Israeltheminer commented on Jun 30, 2026

    @Israeltheminer
    Contributor

    Verified resolved on main — closing as already fixed (duplicate of #2075).

    The cited line new Date(args.dateTo).getTime() in list_executions_paginated_native.ts was removed by #2239 (commit da2e833). Date-range parsing now routes through parseExecutionDateBounds() in workflows/executions/date_range_filter.ts, which expands a bare YYYY-MM-DD dateTo to the last millisecond of that UTC day (toDate += DAY_MS - 1) so the end day is inclusive — exactly the off-by-one reported here. Regression coverage lives in date_range_filter.test.ts.

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