DateFormatter

Om komponenten

DateFormatter er et skjemaelement som gir brukeren mulighet til å fylle inn dato.

Divider

Varianter

<DateFormatter
    options={{
    day: '2-digit',
    month: '2-digit',
    year: 'numeric'
  }}
  value={new Date("1929-08-19T00:00:00.000Z")}
/>
<DateFormatter
  options={{
    day: 'numeric',
    month: 'long',
    year: 'numeric'
  }}
  value={new Date("1929-08-19T00:00:00.000Z")}
/>
<DateFormatter
  options={{
    day: 'numeric',
    hour: 'numeric',
    minute: 'numeric',
    month: 'long',
    second: 'numeric',
    year: 'numeric'
  }}
  value={new Date("1929-08-19T00:00:00.000Z")}
/>
<DateFormatter
  options={{
    year: 'numeric'
  }}
  value={new Date("1929-08-19T00:00:00.000Z")}
/>
<DateFormatter
  options={{
    month: 'short'
  }}
  value={new Date("1929-08-19T00:00:00.000Z")}
/>
<DateFormatter
  options={{
    month: 'long'
  }}
  value={new Date("1929-08-19T00:00:00.000Z")}
>
  {(formattedDate: string) =>
    formattedDate.charAt(0).toUpperCase() + formattedDate.slice(1)
  }
</DateFormatter>
<DateFormatter
  options={{
    month: 'long'
  }}
  value={new Date("1929-08-19T00:00:00.000Z")}
>
  {(formattedDate: string) =>
    formattedDate.charAt(0).toUpperCase() + formattedDate.slice(1)
  }
</DateFormatter>
<DateFormatter
  options={{
    day: 'numeric'
  }}
  value={new Date("2001-01-01T00:00:00.000Z")}
/>

Props

DateFormatter

PropDescriptionDefault
value-
options?-
children?Callback to customize the rendering of the date-