Skip to main content

Date input

Usage

Overview

The date input combines three distinct input fields - day, month, and year - into a single date component. Users enter dates unrelated to the current date, such as birth dates, using this component.

When to use

  • When the date is well-known to the user, such as a birth date or credit card expiration.
  • When precise date entry is required and calendar selection might be cumbersome. For example, if the user needs to enter a date that's in the distant past or future, it can be faster and more efficient to manually type the date.

When not to use

  • For dates that are close to the current time (for example, within the next few weeks or months). Instead, use the date picker.
  • If the user is unlikely to have the date committed to memory (for example, scheduling an appointment several months in the future). Instead, use the date picker.

Types

The date input component offers three variants to accommodate different date-related input needs.

VisualTypePurpose
Date variantDateUsers enter a full date (day, month, and year).
Month variantMonthUsers enter a specific month and year, without a day.
Year variantYearUsers enter a year only.

Formatting

Anatomy

Date input anatomy

The date input consists of the following elements:

  1. Label: A clear and concise description that provides the purpose and context of the date input field. The label helps users understand the date they are expected to enter.
  2. Day field: An input field where the user can manually type in the day.
  3. Month field: An input field where the user can manually type in the month.
  4. Year field: An input field where the user can manually type in the year.

Date format

The date input component adapts to the user's locale settings, presenting the day, month, and year fields in the order most familiar to them. For example:

  • United States: MM/DD/YYYY
  • United Kingdom: DD/MM/YYYY
  • Japan: YYYY/MM/DD

The component automatically adjusts the field order and labels to match the appropriate date format for the user's region.

Image depicting date formats for European and U.S. locales The order of the inputs changes depending on the locale. Examples for Europe (left) and U.S. (right).

Label placement

The label for the date input can appear at the top (default and recommended) or on the left of the input itself.

Image depicting the date input label at the top and left of the input

Content

General writing guidelines

  • Use sentence case for all aspects of designing Guidewire product interfaces. Don't use title case.
  • Use present tense verbs and active voice in most situations.
  • Use common contractions to lend your copy a more natural and informal tone.
  • Use plain language. Avoid unnecessary jargon and complex language.
  • Keep words and sentences short.

Include a label

Place a clear, visible label outside the date input field. An input field without a label is ambiguous and not accessible.

Do position a permanent label outside the field.
Don't assume that the field is self-explanatory without a label.

Use help text

When using a date input, include the date format as help text. Relying solely on placeholder text to communicate the date format is problematic because placeholder text disappears once the user starts typing. This can leave users unsure of the expected format.

Source: Nielsen Norman Group

Do include the date format as help text.
Don't rely solely on placeholder text to communicate the date format.

Behaviors

States

The date input field appears with no value (default), placeholder text, or a filled input.

VisualStateDescription
No valueNo value (default)Indicates to the user that no value has been entered and there is no placeholder.
PlaceholderPlaceholderIndicates to the user that no value has been entered. The placeholder is greyed out.
FilledFilled inputIndicates to the user that the input is filled with data.

Date input fields also have interactive states for enabled, focus, disabled, error, read-only, and display-only.

Image depicting date input states

Interactions

Mouse

Users can interact with this element by clicking in the area inside border.

Image depicting a user interacting with the date input control using a mouse

Keyboard

The input element is keyboard accessible. Users can navigate into and out of the component using the TAB key.

Screen reader

The number input component derives its accessible name using an aria-label attribute. Changing the text value of the label element also changes the value of the accessible name. The default aria-required='true' attribute toggles to 'false' when the required checkbox is checked in Storybook.

Accessibility

The contrast ratio of textual elements against their background is above 4.5:1 as per WCAG 2.1 AA requirements. Non-textual content that needs to convey meaning (such as icons and keyboard focus visibility) has a contrast ratio of at least 3:1 with its adjacent colors. All content is visible and functional up to and including 400% without requiring scrolling in two dimensions.

This component has been validated to meet the WCAG 2.1 AA accessibility guidelines. However, changes made by the content author can affect accessibility conformance.

When using this component, ensure the label clearly communicates which date the user needs to input.