Edit page

DatePicker

A date picker implemented with Airbnb's react-dates library. Any props available in the react-dates library are available in our wrapped component.

Import Syntax

Basic Usage

Navigate forward to interact with the calendar and select a date. Press the question mark key to get the keyboard shortcuts for changing dates.

Basic Usage (with Formik)

Navigate forward to interact with the calendar and select a date. Press the question mark key to get the keyboard shortcuts for changing dates.

{
  "birthday": null
}

Date Range

Navigate forward to interact with the calendar and select a date. Press the question mark key to get the keyboard shortcuts for changing dates.

Navigate backward to interact with the calendar and select a date. Press the question mark key to get the keyboard shortcuts for changing dates.

Date Range (with Formik)

Navigate forward to interact with the calendar and select a date. Press the question mark key to get the keyboard shortcuts for changing dates.

Navigate backward to interact with the calendar and select a date. Press the question mark key to get the keyboard shortcuts for changing dates.

{
  "booking": {
    "startDate": null,
    "endDate": null
  }
}

Append to Body

Navigate forward to interact with the calendar and select a date. Press the question mark key to get the keyboard shortcuts for changing dates.

Hidden Icon

Navigate forward to interact with the calendar and select a date. Press the question mark key to get the keyboard shortcuts for changing dates.

Navigate forward to interact with the calendar and select a date. Press the question mark key to get the keyboard shortcuts for changing dates.

Navigate backward to interact with the calendar and select a date. Press the question mark key to get the keyboard shortcuts for changing dates.

Month and Year Select

Navigate forward to interact with the calendar and select a date. Press the question mark key to get the keyboard shortcuts for changing dates.

Navigate forward to interact with the calendar and select a date. Press the question mark key to get the keyboard shortcuts for changing dates.

Navigate forward to interact with the calendar and select a date. Press the question mark key to get the keyboard shortcuts for changing dates.

Navigate backward to interact with the calendar and select a date. Press the question mark key to get the keyboard shortcuts for changing dates.

Props

DatePicker default

PropertyTypeRequiredDefaultDescription
placeholderStringfalseDatePlaceholder text for the DatePicker text field.
monthYearSelectionModeEnumfalseNONEDetermine if year and/or month dropdowns should be shown in the calendar popup
yearSelectDatesShapefalse{ startYear: new moment().subtract(50, year).year(), endYear: new moment().year() }The years that will be used to populate the year dropdown menu
numberOfMonthsNumberfalse1The number of months to show in the popup
dateCustomfalse-The currently selected moment date object for the component.
onDateChangeFunctrue-Callback function when the selected date is changed.
focusedBoolfalse-Describe whether the DatePicker is currently focused; displays the calendar dropdown.
onFocusChangeFunctrue-Callback function when the focus state of the DatePicker is changed.
idStringtrue-An id supplied to the DatePicker.
hideInputIconBoolfalse-Toggle visibility of the calendar icon in the input

DateRangePicker

PropertyTypeRequiredDefaultDescription
startDatePlaceholderTextStringfalseStart DatePlaceholder text for the start date text field.
endDatePlaceholderTextStringfalseEnd DatePlaceholder text for the end date text field.
monthYearSelectionModeEnumfalseNONEDetermine if year and/or month dropdowns should be shown in the calendar popup
yearSelectDatesShapefalse{ startYear: new moment().subtract(50, year).year(), endYear: new moment().year() }The years that will be used to populate the year dropdown menu
startDateCustomfalse-The currently selected moment date object for the start date.
startDateIdStringtrue-Id provided to the start date text field.
endDateCustomfalse-The currently selected moment date object for the end date.
endDateIdStringtrue-Id provided to the end date text field.
onDatesChangeFunctrue-Callback function when the start or end date is changed.
focusedInputEnumfalse-The name of the currently focused text field.
onFocusChangeFunctrue-Callback function when the focused input is changed.
hideInputIconBoolfalse-Toggle visibility of the calendar icon in the input