Skip to content

Highlighting single date fields which are in error #455

@DavidBiddle

Description

@DavidBiddle

The Design System's guidance for Date Inputs has a subsection about error messages. This contains the following recommendations (abridged slightly):

If you’re highlighting just one field - either the day, month or year - only style the field that has an error. The error message must say which field has an error

If nothing is entered: Highlight the date input as a whole.
If the date is incomplete: Highlight the day, month or year field where the information is missing or incomplete. If more than one field is missing information, highlight the fields the user needs to fill in.
If the date entered cannot be correct: For example, ‘13’ in the month field cannot be correct. Highlight the day, month or year field with the incorrect information. Or highlight the date as a whole if there’s incorrect information in more than one field, or it’s not clear which field is incorrect.
If the date is in the future when it needs to be in the past: Highlight the date input as a whole.
If the date is in the future when it needs to be today or in the past: Highlight the date input as a whole.
If the date is in the past when it needs to be in the future: Highlight the date input as a whole.
If the date is in the past when it needs to be today or in the future: Highlight the date input as a whole.
If the date must be the same as or after another date: Highlight the date input as a whole.
If the date must be after another date: Highlight the date input as a whole.
If the date must be the same as or before another date: Highlight the date input as a whole.
If the date must be before another date: Highlight the date input as a whole.
If the date must be between two dates: Highlight the date input as a whole.

Is there a known/recommended way to highlight a single date field that's in error? As far as I can tell there's no easy way of doing this with the gem's date input component.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions