Skip to content

[Bug] DateInput, DateTimeInput: a nonexistent or out-of-range date errors mid-typing, before Enter or blur #10367

Closed

Description

@duytbp

Description

Since 0.7.9 DateInput and DateTimeInput reject typed text that names a date that doesn't exist, or one min, max or dateConstraints rule out, as soon as the text is complete, while focus is still in the field. Unreadable and incomplete text waits for Enter or blur. typedDateError in useTypedDate.ts returns nonexistent or outOfRange when result.isComplete || isCommitted, and the field then shows and announces the error and sets aria-invalid.

A person who types 31/12/2026 into a field with max="2026-12-30" and means to correct it before leaving the field gets an error mid-entry. Forms that validate on blur and submit can't keep that timing: there is no option to defer these errors to commit, as unreadable text already is.

Expected: a nonexistent or out-of-range date shows and announces its error on Enter or blur, as unreadable text does; or a prop that sets this timing.

Reproduction

import {DateInput} from '@astryxdesign/core';

export function Repro() {
  return <DateInput label="Due" onChange={() => {}} max="2026-12-31" />;
}
  1. Focus the field and type 02/31/2026 without leaving it.
  2. The error "This date does not exist in the Gregorian Calendar" shows and aria-invalid is true while focus is still in the field.
  3. Type abc instead: nothing shows until Enter or blur.

Expected: step 2 shows the error only on Enter or blur.

Astryx Version

@astryxdesign/[email protected] (useTypedDate.ts on main is unchanged)

Environment

Read from a jsdom test and from useTypedDate.ts. Browser-independent.

Activity

  1. nynexman4464 commented on Nov 11, 2026

    @nynexman4464
    Contributor

    Thanks for the report. The decision:

    • The current timing stays the default: a date the calendar doesn't have, or one outside min, max, or dateConstraints, shows its error as soon as the date is complete.
    • For forms that validate on blur, Astryx will add a validation-timing option shared by every input that checks its own entries, not only dates: validationTiming: 'complete' | 'commit' on DateInput, DateTimeInput, TimeInput, and NumberInput, defaulting to 'complete'. FormLayout gets a form-wide defaultValidationTiming, and a field's own prop wins. validationTiming="commit" gives the behavior this issue asks for.
    • A spec record for the option comes first, then the implementation.

    #10575 and #11281 make commit timing the only behavior, so they would need to become this option instead.

  2. nynexman4464 commented on Nov 11, 2026

    @nynexman4464
    Contributor

    Naming update: the option is validationBehavior: 'complete' | 'commit', with defaultValidationBehavior on FormLayout and an exported ValidationBehavior type. It follows Astryx's rule that a prop choosing how a component responds to input is named <thing>Behavior. The values and the default are unchanged.

  3. nynexman4464 commented on Nov 12, 2026

    @nynexman4464
    Contributor

    Naming update: the values are now validationBehavior: 'complete' | 'blur-or-enter' (the form-level default stays defaultValidationBehavior). 'blur-or-enter' names both triggers: the error appears when the person leaves the field or presses Enter. Separate 'blur' and 'enter' values would allow bad modes. With Enter only, someone who tabs away from a wrong entry is never told. With blur only, Enter accepts wrong text with no error. The behavior and the default are unchanged.

  4. nynexman4464 commented on Nov 12, 2026

    @nynexman4464
    Contributor

    Naming update: the prop is entryErrorBehavior: 'complete' | 'blur-or-enter', with defaultEntryErrorBehavior on FormLayout and an exported EntryErrorBehavior type. The new name avoids React Aria's validationBehavior, which means something else (native versus ARIA validation). It also matches the existing onEntryErrorChange, and it says that the prop controls when the field's own entry error shows, not when validation runs. The behavior and the default are unchanged.

  5. duytbp commented on Nov 14, 2026

    @duytbp
    ContributorAuthor

    Fixed in v0.7.16 by entryErrorBehavior="blur-or-enter". Thank you!

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions