Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check how dates and times are rendered across the application #2679

Open
bmarty opened this issue Dec 30, 2024 · 0 comments
Open

Check how dates and times are rendered across the application #2679

bmarty opened this issue Dec 30, 2024 · 0 comments

Comments

@bmarty
Copy link
Member

bmarty commented Dec 30, 2024

Here is a list of all the places where time and or date are rendered across the application.
We could want to review them, and decide for a format.

Constraints are:

  • the date and time must render correctly regarding the current Locale
  • the date and time may render differently depending on the diff with now
  • other?

Element X Android has a recent update on this part, and we have introduced date and time "Mode" (DateFormatterMode, code), combined with a boolean useRelative:

interface DateFormatter {
    fun format(
        timestamp: Long?,
        mode: DateFormatterMode = DateFormatterMode.Full,
        useRelative: Boolean = false,
    ): String
}

enum class DateFormatterMode {
    /**
     * Full date and time.
     * Example:
     * "April 6, 1980 at 6:35 PM"
     * Format can be shorter when useRelative is true.
     * Example:
     * "6:35 PM"
     */
    Full,

    /**
     * Only month and year.
     * Example:
     * "April 1980"
     * "This month" can be returned when useRelative is true.
     * Example:
     * "This month"
     */
    Month,

    /**
     * Only day.
     * Example:
     * "Sunday 6 April"
     * "Today", "Yesterday" and day of week can be returned when useRelative is true.
     */
    Day,

    /**
     * Time if same day, else date.
     */
    TimeOrDate,

    /**
     * Only time whatever the day.
     */
    TimeOnly,
}
Usage Comment Mode useRelative Screenshot
Room list last message - TimeOrDate true imageimage
Timeline day separator - Day true imageimageimage
Timeline event This is not ideal without sticky headers for the day, when scrolling through history, but sticky headers are coming "soon" TimeOnly false image
Event details - Full true imageimage
Gallery month separator - Month true image
Gallery item top title - Day false image
Gallery item detail - Full false image
Reaction details - TimeOrDate false image
Read receipt details - TimeOrDate false image
Poll in poll history - Day true image
Incoming verification request - TimeOrDate false image
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant