Skip to main content
For development, import DateFieldYearlessRange from @servicetitan/anvil2. For design, find it in the Anvil2 file.

Anatomy

Date Field Yearless Range consists of seven primary elements that enable users to select a start and end date without year information.
Anatomy of the Date Field Yearless Range component
  1. Label - Identifies the field and its purpose
  2. Start date input - Text input for manual start date entry with format mask
  3. End date input - Text input for manual end date entry with format mask
  4. Helper text (Optional) - Description, format hint or error message

Options

Date Field Yearless Range supports the following configurations to accommodate different use cases and regional preferences.

Date Format Modes

Date Field Yearless Range supports two date format modes to match regional conventions. The default format is mm/dd for US audiences, while dd/mm is available for international users.

Sizes

Three size options accommodate different layout densities and visual hierarchies.

Date Picker

The date picker can be disabled when manual text entry is preferred or when the picker interface is not suitable for the use case.

Behavior

Date Field Yearless Range responds to user interaction with distinct visual states and validation feedback.

Visual States

The component displays different visual states to communicate field status and interactivity. Default state shows both fields ready for input. Focus state highlights the active field. Error state displays validation messages when date ranges are invalid, start dates are after end dates, or required fields are empty. Disabled state prevents interaction while maintaining visual context.

Date Picker Interaction

Clicking either input field opens a popover with two scrollable lists for month and day selection. Users can scroll through months and days and select values directly from the lists. The picker closes automatically after selection, and the selected month and day populate the respective input field.

Validation

Date Field Yearless Range validates input in real time. The component checks for parseable month and day values, required field completion, date constraints (min/max dates), unavailable dates, and logical range validation (start date must be before or equal to end date). Error messages appear below the fields when validation fails.

Usage Guidelines

Alternatives

Date Field Yearless Range vs Date Field Range

Use Date Field Yearless Range when the year is irrelevant to the date range selection, such as recurring seasonal periods or annual date templates. Use Date Field Range when the year is essential, such as project timelines or reporting periods.

How to Use

Labeling and Yearless Range Validation

Provide clear, descriptive labels that communicate the purpose of the date range selection and indicate that year information is not required. Labels should clarify that only month and day ranges are needed, helping users understand why year input is omitted. Implement validation that ensures logical date ranges and provides immediate feedback when constraints are violated.
  • Write labels that clearly communicate the purpose and indicate year is not needed
  • Include format hints to guide users on expected input format (mm/dd or dd/mm)
  • Set appropriate date constraints (min/max dates) when applicable to prevent invalid selections
  • Validate that start date is before or equal to end date
  • Display validation errors immediately when they occur
  • Use Date Field Yearless Range for recurring date ranges where year context is not needed
  • Maintain consistency when using yearless ranges alongside year-specific ranges in forms

Anti-pattern: Ambiguous Context and Invalid Ranges

Avoid creating confusion by using Date Field Yearless Range for ranges that require year information or allowing invalid date ranges without clear feedback.
  • Use Date Field Yearless Range for date ranges that require year information
  • Omit format hints when the date format might be ambiguous to users
  • Hide validation errors until form submission
  • Allow start dates to be after end dates without clear error messaging
  • Use placeholder text to communicate date format instead of format hints
  • Mix yearless date ranges with year-specific date ranges in the same form without clear visual or contextual distinction
  • Create labels that don’t indicate year is not required

Content

Content within Date Field Yearless Range should be clear, concise, and actionable.
  • Labels should clearly indicate what date range is being selected and that year is not required
  • Error messages should explain why a date range is invalid and how to fix it
  • Format hints should match the selected mode (mm/dd or dd/mm)
  • Descriptions should provide context without overwhelming the user

Keyboard Interaction

Users can navigate Date Field Yearless Range using standard keyboard controls.

Input Fields

Date Picker

Accessibility

Date Field Yearless Range includes built-in accessibility features. The component uses semantic grouping to associate the start and end date inputs. The component supports full keyboard navigation and screen reader compatibility. Ensure labels are descriptive and error messages are clear for assistive technology users. For more guidance on form field labels and context, see input field context association best practices.

Code

Common Examples

Controlled vs Uncontrolled

The DateFieldYearlessRange component can be used in controlled or uncontrolled mode.

Uncontrolled

Use defaultValue to set an initial value without controlling the state.

Controlled

Use value and onChange for full control over the component state.

Date Format Modes

The component supports two date format modes: mm/dd (default) and dd/mm.

With Validation

Show error states when validation fails.

Sizes

The component supports small, medium, and large sizes.

Custom Labels

Customize the accessible labels for the start and end date fields.

React Accessibility

  • The component uses a fieldset with a legend for proper grouping
  • Start and end date fields have individual accessible labels (visually hidden)
  • Error messages are announced via aria-live
  • The moreInfo tooltip content is also available to screen readers
For more guidance on form field labels and context, see input field context association best practices.

Markdown in labels

The label prop supports inline markdown: bold (**text**), italic (*text*), bold and italic (***text***), highlight (==text==), and code (`text`).

Hide the label

Use hideLabel to visually hide the label. The label string is kept as a screen-reader-only <legend> element so the group remains accessible — any inline markdown is stripped to plain text.

Testing

Interactive sub-elements carry a stable data-anv-part attribute so end-to-end tests can target them. Attach your own data-* (such as data-cy) to the field — it is forwarded to the fieldset root:
The shared yearless picker also stamps popover, month-list, day-list, and option (see Date Field Yearless Testing). Those parts render in the top layer and are not descendants of the fieldset.
Last modified on October 27, 2026