Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Show dynamically time, relative date, weekday, or short date in channel lists #833

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

Merged
merged 4 commits into from
May 27, 2025

Conversation

laevandus
Copy link
Contributor

@laevandus laevandus commented May 21, 2025

🔗 Issue Links

Resolves IOS-851

🎯 Goal

  • Show time, relative date, weekday or short date in channel lists instead of just time of the message (disabled by default, can be enabled with utils.channelListConfig.messageRelativeDateFormatEnabled = true)

📝 Summary

  • Add ChannelListDateFormatter for dynamic date formatting (based on the UIKit implementation)
  • Add Utils.channelListDateFormatter for overriding the formatting behaviour
  • Add ChannelListConfig for channel specific settings
  • Use the new formatter in channel list and channel search (if ChannelListConfig.messageRelativeDateFormatEnabled is set to true)
  • Enabled the behaviour in the demo app

🛠 Implementation

Logic:
Today: only time, e.g 12:10
Yesterday: "Yesterday"
Last 7 days: Weekday e.g. "Monday"
Older: short date, e.g. 21.05.2025

🎨 Showcase

Before After
BeforeChannels AfterChannels
BeforeSearch AfterSearch

🧪 Manual Testing Notes

Open channel list and observe last message dates
Search for channels and observe last message dates

☑️ Contributor Checklist

  • I have signed the Stream CLA (required)
  • This change should be manually QAed
  • Changelog is updated with client-facing changes
  • Changelog is updated with new localization keys
  • New code is covered by unit tests
  • Documentation has been updated in the docs-content repo

@laevandus laevandus requested a review from a team as a code owner May 21, 2025 08:26
@laevandus laevandus added the ✅ Feature An issue or PR related to a feature label May 21, 2025
@laevandus laevandus changed the title Show dynamically time, relative date, weekday, or short date in channel lists [WIP] Show dynamically time, relative date, weekday, or short date in channel lists May 21, 2025
@laevandus laevandus changed the title [WIP] Show dynamically time, relative date, weekday, or short date in channel lists Show dynamically time, relative date, weekday, or short date in channel lists May 21, 2025
@laevandus laevandus marked this pull request as draft May 21, 2025 08:28
@Stream-SDK-Bot
Copy link
Collaborator

Stream-SDK-Bot commented May 21, 2025

SDK Size

title develop branch diff status
StreamChatSwiftUI 8.22 MB 8.23 MB +18 KB 🟢

@laevandus laevandus force-pushed the add/channel-list-date-time-formatting branch from 7fb9e52 to 3cdc4c2 Compare May 21, 2025 08:32
/// A formatter that converts last message timestamps in the channel list.
///
/// Shows time, relative date, weekday or short date based on days passed.
public final class ChannelListDateFormatter: DateFormatter, @unchecked Sendable {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All of this is based on UIKit's implementation

@laevandus laevandus force-pushed the add/channel-list-date-time-formatting branch 2 times, most recently from aaa344f to c4b869d Compare May 21, 2025 11:13
@laevandus laevandus marked this pull request as ready for review May 21, 2025 11:14
@laevandus laevandus force-pushed the add/channel-list-date-time-formatting branch from c4b869d to b1fbd2d Compare May 21, 2025 12:01
Copy link
Member

@nuno-vieira nuno-vieira left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm requesting changes since this would be a breaking UI change for customers, we need to try to use the same utils.dateFormatter, otherwise looks good 👍

CHANGELOG.md Show resolved Hide resolved
@laevandus laevandus marked this pull request as draft May 21, 2025 12:12
@laevandus laevandus force-pushed the add/channel-list-date-time-formatting branch 2 times, most recently from 38b085c to de14eb2 Compare May 22, 2025 07:41
@laevandus laevandus force-pushed the add/channel-list-date-time-formatting branch from de14eb2 to 9d26265 Compare May 22, 2025 07:47
@laevandus laevandus marked this pull request as ready for review May 22, 2025 07:50
Copy link
Member

@nuno-vieira nuno-vieira left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! ✅

Copy link
Contributor

@martinmitrevski martinmitrevski left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good ✅ probably better to have it on by default, but leaving it up to you two to decide.

CHANGELOG.md Show resolved Hide resolved
@laevandus laevandus enabled auto-merge (squash) May 27, 2025 08:54
Copy link

@laevandus laevandus merged commit 2b23197 into develop May 27, 2025
11 checks passed
@laevandus laevandus deleted the add/channel-list-date-time-formatting branch May 27, 2025 09:30
@Stream-SDK-Bot Stream-SDK-Bot mentioned this pull request May 29, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
✅ Feature An issue or PR related to a feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants
Morty Proxy This is a proxified and sanitized view of the page, visit original site.