Skip to main content
FieldValue
Package@cometchat/chat-uikit-angular
Key classCometChatLocalize (global CalendarObject management)
Key componentCometChatDateComponent (cometchat-date element)
Required setupCometChatUIKit.init(uiKitSettings)
PurposeCustomize date/time formatting globally, per-component, or per-language
FeaturesLanguage-specific defaults, global override, per-instance override, relative time
RelatedLocalization | Theming
CometChat UIKit provides flexible date/time formatting with language-aware defaults. Dates automatically adapt when you switch languages, and you can override formats globally or per-component.
CapabilityDescription
Language-specific defaultsDate formats auto-adapt per language (e.g., MM/DD/YYYY for en-US, DD/MM/YYYY for en-GB)
Global overrideSet a custom CalendarObject that applies to all components
Per-component overridePass a CalendarObject input to individual cometchat-date instances
Relative timeConfigure “X minutes ago” style formatting
Timezone supportSet timezone globally via CometChatLocalize

How It Works

The cometchat-date component resolves its date format using a fallback chain:
  1. Component [calendarObject] input (highest priority)
  2. Global CalendarObject from CometChatLocalize.getCalendarObject()
  3. Hardcoded fallback: hh:mm A / [Yesterday] / dddd / DD/MM/YYYY

Language-Specific Defaults

When you switch languages, date formats automatically adapt:
LanguageTodayYesterdayOther Days
en-UShh:mm A[Yesterday]MM/DD/YYYY
en-GBHH:mm[Yesterday]DD/MM/YYYY
deHH:mm[Gestern]DD.MM.YYYY
frHH:mm[Hier]DD/MM/YYYY
esHH:mm[Ayer]DD/MM/YYYY
jaHH:mm[昨日]YYYY/MM/DD
koHH:mm[어제]YYYY/MM/DD
zhHH:mm[昨天]YYYY/MM/DD
ruHH:mm[Вчера]DD.MM.YYYY
svHH:mm[Igår]YYYY-MM-DD

Global Date Format Override

Set a custom CalendarObject that applies to all cometchat-date instances:
Once you set a custom global CalendarObject, switching languages will NOT override it. Your custom format is preserved across language changes. To revert to language-specific defaults, you would need to reset the CalendarObject.

Via Initialization


Per-Component Override

Pass a calendarObject input to individual cometchat-date instances:
The component input always takes priority over the global CalendarObject.

CalendarObject Reference

Format Tokens

TokenOutputExample
YYYY4-digit year2026
YY2-digit year26
MM2-digit month03
DD2-digit day23
ddddFull weekdayMonday
dddShort weekdayMon
HH24-hour hour14
hh12-hour hour02
mmMinutes30
AAM/PMPM
[text]Literal text[Yesterday] → Yesterday

Relative Time

Enable “X minutes ago” style formatting:
When relativeTime is configured, recent messages show relative timestamps instead of absolute times.

Timezone


Example: Custom Date Formats


Next Steps

Localization

Override translations globally or per-component.

Theming

Customize colors, fonts, and spacing.

Custom Message Types

Add custom message types with templates.

Global Config

Configure global UIKit settings.