Skip to content

Date filter doesn't work via query parameters (Zod validation error) #14

@sergey-chek

Description

@sergey-chek

The date filter (startDate / endDate) doesn't work when passed as query parameters. The API returns a Zod validation error expecting date type but receiving string.

Steps to Reproduce

  1. Start taskiq-admin
  2. Create some tasks
  3. Try to filter by date via URL:
    http://localhost:3000/tasks?page=1&perPage=20&search=test&startDate=2026-01-19&endDate=2026-01-21

Expected Behavior

Tasks filtered by date range should be returned.

Actual Behavior

API returns validation error:

{
  "error": true,
  "statusCode": 400,
  "statusMessage": "Validation Error",
  "message": "[{\"expected\":\"date\",\"code\":\"invalid_type\",\"path\":[\"startDate\"],\"message\":\"Invalid input: expected date, received string\"}]"
}

Analysis

Query string parameters are always strings. Zod schema expects JavaScript Date object which is impossible to pass via URL. The schema should coerce string to Date:

// Current (broken)
startDate: z.date().optional()

// Should be
startDate: z.coerce.date().optional()

Environment

  • taskiq-admin version: 1.8.1
  • Docker image: ghcr.io/taskiq-python/taskiq-admin:1.8.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions