Skip to content

Properties

PropertyTypeDescription
datestring
Date
(optional) Defines the pre-filled date by either a JavaScript DateInstance or (ISO 8601) like date="2019-05-05" and content.
startDatestring
Date
(optional) To set the pre-filled starting date. Is used if range={true} is set to true. Defaults to null, showing the maskPlaceholder.
endDatestring
Date
(optional) To set the pre-filled ending date. Is used if range={true} is set to true. Defaults to null, showing the maskPlaceholder
monthstring
Date
(optional) To display what month should be shown in the first calendar by default. Defaults to the date respective startDate.
startMonthstring
Date
(optional) To display what month should be shown in the first calendar by default. Defaults to the date respective startDate.
endMonthstring
Date
(optional) To display what month should be shown in the second calendar by default. Defaults to the date respective startDate.
minDatestring
Date
(optional) To limit a date range to a minimum startDate. Defaults to null.
maxDatestring
Date
(optional) To limit a date range to a maximum endDate. Defaults to null.
dateFormatstring(optional) Defines how the property dates (date, startDate and endDate) should be parsed, e.g. yyyy/MM/dd. Defaults to yyyy-MM-dd.
returnFormatstring(optional) Defines how the returned date, as a string, should be formatted as. Defaults to yyyy-MM-dd.
rangeboolean(optional) Defines if the Date field should support a value of two dates (starting and ending date). The value needs to be a string containing two dates, separated by a pipe character (|) (01-09-2024|30-09-2024) when this is set to true. Defaults to false.
showInputboolean(optional) If the input fields with the mask should be visible. Defaults to false.
maskOrderstring(optional) To define the order of the masked placeholder input fields. Defaults to dd/mm/yyyy.
openedboolean(optional) To open the date-picker by default. Defaults to false.
maskPlaceholderstring(optional) To display the placeholder on input. Defaults to dd/mm/åååå.
hideNavigationboolean(optional) If set to true, the navigation will be hidden. Defaults to false.
hideDaysboolean(optional) If set to true, the week days will be hidden. Defaults to false.
showSubmitButtonboolean(optional) If set to true, a submit button will be shown. You can change the default text by using submitButtonText="Ok". Defaults to false. If the range property is true, then the submit button is shown.
showCancelButtonboolean(optional) If set to true, a cancel button will be shown. You can change the default text by using cancelButtonText="Avbryt". If the range property is true, then the cancel button is shown. Defaults to false
showResetButtonboolean(optional) If set to true, a reset button will be shown. You can change the default text by using resetButtonText="Tilbakestill". Defaults to false.
linkboolean(optional) Link both calendars, once to the user is navigating between months. Only meant to use if the range is set to true. Defaults to false.
syncboolean(optional) Sync input values with the calendars views. Once the input values get changed, the calendar changes its views in sync. Defaults to true.
firstDaymonday
tuesday
wednesday
thursday
friday
saturday
sunday
(optional) To define the first day of the week. Defaults to monday.
alignPickerstring(optional) Use right to change the calendar alignment direction. Defaults to left.
onlyMonthboolean(optional) Use true to only show the defined month. Disables the month navigation possibility. Defaults to false.
hideLastWeekboolean(optional) Use true to only show the last week in the current month if it needs to be shown. The result is that there will mainly be shows five (5) weeks (rows) instead of six (6). Defaults to false.
stretchboolean(optional) If set to true, then the date-picker input field will be 100% in width
labelReact.ReactNode(optional) A prepending label in sync with the date input field.
labelDirectionvertical
horizontal
(optional) Use label_direction="vertical" to change the label layout direction. Defaults to horizontal.
suffixReact.ReactNode(optional) Text describing the content of the DatePicker more than the label. You can also send in a React component, so it gets wrapped inside the DatePicker component.
labelSrOnlyboolean(optional) Use true to make the label only readable by screen readers.
shortcutsobject(optional) Gives you the possibility to set predefined dates and date ranges so the user can select these by one click. Define either a JSON or an object with the defined shortcuts. More info is below.
addonElementobject(optional) Gives you the possibility to inject a React element showing up over the footer. Use it to customize shortcuts.
inputElementReact.ReactNode(optional) Gives you the possibility to use a plain/vanilla <input /> HTML element by defining it as a string inputElement="input", a React element, or a render function inputElement={(internalProps) => (<Return />)}. Can also be used in circumstances where the react-text-mask should not be used, e.g. in testing environments. Defaults to custom masked input.
statusstring | boolean(optional) Text with a status message. The style defaults to an error message. You can use true to only get the status color, without a message.
statusStatestring(optional) Defines the state of the status. Currently, there are two statuses [error, info]. Defaults to error.
statusPropsobject(optional) Use an object to define additional FormStatus properties.
disableAutofocusboolean(optional) Once the date picker gets opened, there is a focus handling to ensure good accessibility. This can be disabled with this property. Defaults to false.
correctInvalidDateboolean(optional) Corrects the input date value to be the same as either minDate or maxDate, when the user types in a date that is either before or after one of these. Defaults to false.
globalStatusobject(optional) The configuration used for the target GlobalStatus.
tooltipstring(optional) Provide a short Tooltip content that shows up on the picker button.
skeletonboolean(optional) If set to true, an overlaying skeleton with animation will be shown.
sizestring(optional) The sizes you can choose is small (1.5rem), default (2rem), medium (2.5rem) and large (3rem) are supported component sizes. Defaults to default / null.
Spacestring
object
(optional) Spacing properties like top or bottom are supported.

Translations

More info about translations can be found in the general localization and Eufemia Forms localization docs.

Keynb-NOen-GB
DatePicker.daydagDay
DatePicker.monthmånedMonth
DatePicker.yearårYear
DatePicker.startfrafrom
DatePicker.endtilto
DatePicker.selectedDateValgt dato: %sSelected date: %s
DatePicker.selectedMonthValgt måned %sSelected month %s
DatePicker.selectedYearValgt år %sSelected year %s
DatePicker.nextMonthNeste måned %sNext month %s
DatePicker.prevMonthForrige måned %sPrevious month %s
DatePicker.nextYearNeste år %sNext year %s
DatePicker.prevYearForrige år %sPrevious year %s
DatePicker.openPickerTextåpne datovelgerOpen date picker
DatePicker.maskOrderdd/mm/yyyydd/mm/yyyy
DatePicker.maskPlaceholderdd.mm.åååådd/mm/yyyy
DatePicker.dateFormatyyyy-MM-ddyyyy-MM-dd
DatePicker.returnFormatyyyy-MM-ddyyyy-MM-dd
DatePicker.submitButtonTextOkOK
DatePicker.cancelButtonTextAvbrytCancel
DatePicker.resetButtonTextTilbakestillReset
DatePicker.placeholderCharacters.daydd
DatePicker.placeholderCharacters.monthmm
DatePicker.placeholderCharacters.yearåy

Shortcuts

You may use date-fns to make date calculations.

Code Editor
<DatePicker
  shortcuts={[
    {
      title: 'Set date',
      date: '1969-07-15',
    },
    {
      title: 'Relative +3 days',
      date: ({ date }) => date && addDays(date, 3),
    },
  ]}
/>

With range enabled.

Code Editor
<DatePicker
  shortcuts={[
    {
      title: 'Set date period',
      start_date: '1969-07-15',
      end_date: '1969-07-15',
      close_on_select: true, // will close the picker
    },
    {
      title: 'This month',
      start_date: startOfMonth(new Date()),
      end_date: lastDayOfMonth(new Date()),
    },
  ]}
/>