- Implementation
- DateFieldSingle Props
- DateFieldSingleChange
Common Examples
Date string values
DateFieldSingle accepts and returns ISO 8601 date strings (for example, "2025-07-02") rather than JavaScript Date objects. Convert Date values from API clients or Anvil1 Date Picker before passing them to the component.Default values
Default values can be included inDateFieldSingle to use the field in an uncontrolled mode.Controlled usage
TheDateFieldSingle can be controlled. This means you can maintain the state outside the component. Listen for new dates with onChange and supply a date into the value prop.Validation
Understanding the object passed back inonChange is key to understanding how to validate this field.isDateValid will tell you if the last entered date is valid according to the props you’ve supplied (e.g. required, minDate, maxDate, and unavailable).isInputValid will tell you only if the underlying input is a parseable date — this does not consider whether the date is good according the other props.isInputEmpty will tell you if the underlying input has no digits entered.Typically, you will want to use these values together to determine the overall validity of the field. Though the simplest implementation may likely suffice to use only isDateValid.Disabled hint text
The hint text can be disabled. If the hint text is disabled, ensure that the date format is displayed on the page.Timezone
Thetimezone prop controls the meaning of the “Today” button and which month-year the calendar initially displays. When the timezone differs from the user’s locale, a disambiguation message appears below the calendar.Disable calendar popover
The display of theCalendar can be prevented by passing disableCalendar.Markdown in labels
Thelabel prop supports inline markdown: bold (**text**), italic (*text*), bold and italic (***text***), highlight (==text==), and code (`text`).Hide the label
UsehideLabel to visually hide the label. The label string is converted to an aria-label on the input so it remains accessible to screen readers — any inline markdown is stripped to plain text.