You are currently viewing outdated (<=3.x) Chameleon documentation on our old website. For version >=4.x, check out our new website.

Current release: 3.5.0 | hub

components

DateTime (beta) (code)

Allows you to display a date in a consistent way through the use of formats.

import { DateTime } from '@mediahuis/chameleon-react'

Props

NameTypeDefaultRequiredDescription
classNameString--Extend classNames.
dateString--Timestamp string (ISO8601) of the date to be displayed.
formatStringdateTimeFormatDefault-Date and time formatting setting. Uses dayjs under the hood.

System Props

System Props

Next to the properties listed in the propstable, a collection of system props can be added to any component for further general styling and layouting purposes. These props vary per component.

To read more about the system, click here to check out its dedicated page.

Date

default: undefined

Timestamp string of the date to be displayed. Provide this in the ISO8601 format that is understood by the native Date object.

import { DateTime } from '@mediahuis/chameleon-react'

Format

default: dateTimeFormatDefault

Date and time formatting setting. Refer to the dayjs docs for all available settings.

On top of the dayjs formats, you can also supply "relative". Under the hood this uses dayjs' RelativeTime plugin.

Each brand has a few tokens which contain some default formats.

import { dateTimeFormatDefault, dateTimeFormatDate, dateTimeFormatTime, dateTimeFormatDateTime } from '@mediahuis/chameleon-theme-wl'
import { DateTime } from '@mediahuis/chameleon-react'

© Copyright 2020 Mediahuis NV. All rights Reserved