DateTimeDisplay

core package3.2.2

Note: All components shown on this site are supported by the Constellation design system. To learn how to configure Theme Cosmos, visit Pega Community.

The DateTimeDisplay component renders any aspect of a dates or time in a large variety of formats.

Date Time

DateTimeDisplay is an ideal component for rendering any date/time as a string representing the absolute or relative value with the added locale support offered via the Configuration component.

Several options are available to modify the appearance of the date/time value provided. The variant defines the scope of the value from time to year and many in-between, as well as a robust relative option that displays the value in plain text. The format of the display can also change from long to short, as well as numeric. You can also change the clockFormat from 12 hours to 24 hours.

Example

Oct 2, 2026

Duration

The DurationDisplay component only displays the amount of time that has passed since the given value (provided in milliseconds). The time passed will be displayed in a rather simple format of days, hours, minutes, and seconds passed. The specificity of the display can be altered via the significantUnits prop where 4 will display all of the units available and 1 will display only the hours. Lowering the number of units to display will not cause the values for each unit to round up.

Example

5d 8h 29m 13s

Related components

Properties

NameDescriptionDefaultType
variant*Controls date time variant.DateTimeVariant
classNameAdditional CSS classes.string
clockFormatDefines clock format that overrides locale based formatClockFormat
formatControls display format."short"DateTimeFormat
refRef for the wrapping element.Ref<HTMLSpanElement>
valueDate as ISO8601 string, timestamp or native Date object.
string |number |Date