Skip to content

enhancement: validate start ≤ end in date range forms before submitting #60

@ali5ter

Description

@ali5ter

Summary

The splash date range form and the in-TUI date range dialog (internal/tui/splash.go) validate each date field individually with validateDate (format only), but do not check that start ≤ end. If a user enters From: 2026-05-18 and To: 2026-01-01, the form submits successfully, api.DateRange returns an error, and the TUI shows a generic error screen with no recovery path (other than quitting and relaunching).

Why it matters

The error message returned by api.DateRange ("start date 2026-05-18 is after end date 2026-01-01") is informative but unreachable in the TUI — it becomes the msg.err from dataMsg, which renders as a static error with "Press q to quit." The user has to restart the app entirely.

Suggested approach

Add a cross-field validation either:

  1. In validateDate on the end field by accessing the form's start value (huh supports cross-field validation via closures).
  2. Or as a post-submit check before firing the splashDoneMsg / data fetch command — if start > end, redisplay the date form with a pre-populated error message.

For the in-TUI dialog, catching it here is especially valuable since the user would otherwise be dumped to the unrecoverable error screen.

🤖 Generated with Claude Code on behalf of Alister

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions