Skip to main content
Version: v4

Date

CometChatDate is a widget which is used to show the date and time. You can also customize the appearance of this widget by modifying its logic.

Properties

NameTypeDescription
timestampnumberTimestamp to be displayed in unix format
patternDatePatternsGroup of constants representing the in-built date patterns
customDateStringstringOverride the in-built pattern with your custom representation of the timestamp
dateStyledateStyleStyling properties and values of the Date component

dateStyle

Styling properties and values of the element

NameDescription
widthSets the width of the element
heightSets the height of the element
borderSets the border of the element
borderRadiusSets the border radius of the element
backgroundSets all background style properties at once, such as color, image, origin and size, or repeat method. Reference link
textFontSets all the different properties of font for the date text. Reference link
textColorSets the foreground color of the date text.

Usage

import '@cometchat/uikit-elements'; //import the web elements package.
import { DatePatterns } from 'uikit-resources'; //import the date pattern constant.

//make use of the element; format the timestamp to the in-built time pattern
<cometchat-date timestamp="1686234301" pattern={DatePatterns.time}></cometchat-date>