Import
import { DatePicker } from '@dnb/eufemia'
Description
The DatePicker component should be used whenever there is to enter a single date or a date range/period with a start and end date.
Date Object
The DatePicker operates with a default JavaScript Date instance as well as string (ISO 8601) like start_date="2019-05-05"
(yyyy-MM-dd).
For more DatePicker examples, have a look at this CodeSandbox.
Translations and date formatting
The DatePicker
uses date-fns
to format date texts in the calendar, i.e. the month and weekday names. Currently, the DatePicker
only supports nb-NO
, en-GB
, en-US
and sv-SE
locales, so it will fallback to use nb-NO
as default if you set the locale
prop on the Provider to be something other than the locales supported by the DatePicker
.