DateFormatter

interface DateFormatter

An interface that allows to format date-time objects as strings.

Types

Link copied to clipboard
object Companion

Functions

Link copied to clipboard
abstract fun formatDate(date: Date?): String

Formats the given date as a String. A normal implementation of this method would return a string like "Yesterday", "Saturday", "9:25 AM"/"9:25", ... It is used to format the date of the last message in the channel list and the when an user voted in a poll.

Link copied to clipboard
abstract fun formatRelativeDate(date: Date): String

Returns a relative date string for the given date. A normal implementation of this method would return a string like "Yesterday", "A day ago", ... It is used to format the date of the separator in the message list.

Link copied to clipboard
abstract fun formatRelativeTime(date: Date?): String

Formats the given date as a relative time string. A normal implementation of this method would return a string like "Just now", "5 minutes ago", ... It is used to format the time when a message was edited in the message list.

Link copied to clipboard
abstract fun formatTime(date: Date?): String

Formats the given time as a String. A normal implementation of this method would return a string like "9:25 AM"/"9:25". It is used to format the time of the message in the message list.