Skip to content

[Request]: relative date bounds for forms date and datetime-local fields #705

Closed

Description

@jimhoyd

Problem or use case

Split out of #528 so it can close. Absolute minimum/maximum bounds for type: date and type: datetime-local fields shipped in #697, and conditional required fields (requiredWhen) are closing #528. The remaining part of the original benchmark evidence (test5/form-lab) was a start date constrained to "today through two years ahead": relative bounds. Today the author must hand-write that comparison in an onSubmit hook (if (parsedDate < today || parsedDate > twoYearsFromToday) ...), duplicating field extraction and the 422 error map.

Proposed behavior and alternatives

A bounded, declarative relative bound, for example minimum: today or an offset such as maximum: {from: today, add: P2Y}, resolved per request on the server and rendered as the HTML min/max of the served page.

Questions to decide before implementing (unverified; nothing here is designed yet):

  • Which clock and timezone define "today": the server's UTC date, an operator-configured zone, or a declared per-flow zone? The browser's local date can differ from the server's near midnight, so the rendered min/max and the server check may disagree for a submitter in another zone.
  • Rendered bounds go stale when a page is held open across midnight; the server check must remain authoritative.
  • Portability: the same result on node, aws and vercel.
  • The offset vocabulary should stay small (days/months/years), with no arbitrary expressions.

Until then relative bounds stay in onSubmit, as the forms README says.

Activity

  1. added
    enhancement
    ai-first
    extension
    on Sep 25, 2026
  2. added
    needs-decision
    on Sep 25, 2026
  3. jimhoyd commented on Sep 25, 2026

    @jimhoyd
    CollaboratorAuthor

    Decision (owner, 2026-09-25):

    • Clock: "today" is the current date in a time zone declared on the form flow (an IANA name such as Europe/London). If none is declared, it is UTC. It must not depend on the host's local zone, so the same YAML behaves the same on node, aws and vercel.
    • Vocabulary: today plus a signed offset in days, months or years only (e.g. today, {from: today, add: P2Y}, {from: today, add: -P18Y}). No hours or minutes and no expressions.
    • The server check is authoritative and resolved per request. The rendered HTML min/max are a convenience and may go stale if a page stays open across midnight.

    Ready to implement. Removing needs-decision.


    Generated by Claude Code

  4. removed
    needs-decision
    on Sep 25, 2026
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

    ai-firstenhancementextension

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions