-
Notifications
You must be signed in to change notification settings - Fork 99
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
Conversation
SDK Size
|
7fb9e52
to
3cdc4c2
Compare
Sources/StreamChatSwiftUI/ChatChannel/MessageList/MessageContainerView.swift
Outdated
Show resolved
Hide resolved
/// 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 { |
There was a problem hiding this comment.
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
aaa344f
to
c4b869d
Compare
…channel list and search
c4b869d
to
b1fbd2d
Compare
There was a problem hiding this 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 👍
Sources/StreamChatSwiftUI/ChatChannelList/ChatChannelListItem.swift
Outdated
Show resolved
Hide resolved
38b085c
to
de14eb2
Compare
de14eb2
to
9d26265
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! ✅
There was a problem hiding this 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.
# Conflicts: # CHANGELOG.md
|
🔗 Issue Links
Resolves IOS-851
🎯 Goal
utils.channelListConfig.messageRelativeDateFormatEnabled = true
)📝 Summary
ChannelListDateFormatter
for dynamic date formatting (based on the UIKit implementation)Utils.channelListDateFormatter
for overriding the formatting behaviourChannelListConfig
for channel specific settingsChannelListConfig.messageRelativeDateFormatEnabled
is set to true)🛠 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
🧪 Manual Testing Notes
Open channel list and observe last message dates
Search for channels and observe last message dates
☑️ Contributor Checklist
docs-content
repo