-
public interface DateFormatterAn interface that allows to format date-time objects as strings.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public classDateFormatter.Companion
-
Method Summary
Modifier and Type Method Description abstract StringformatDate(Date date)Formats the given date as a String. abstract StringformatTime(Date date)Formats the given time as a String. abstract StringformatRelativeTime(Date date)Formats the given date as a relative time string. abstract StringformatRelativeDate(Date date)Returns a relative date string for the given date. -
-
Method Detail
-
formatDate
abstract String formatDate(Date date)
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.
- Parameters:
date- The Date to format as a String.
-
formatTime
abstract String formatTime(Date date)
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.
- Parameters:
date- The Date object to format as a String.
-
formatRelativeTime
abstract String formatRelativeTime(Date date)
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.
- Parameters:
date- The Date to format as a relative time string.
-
formatRelativeDate
abstract String formatRelativeDate(Date date)
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.
- Parameters:
date- The Date to format as a relative date string.
-
-
-
-