Skip to main content
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.

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:

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


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.