Support date in MM/DD/YY format
Describe the bug
Channel Preview currently shows date in DD/MM/YY format. unfortunately, this date format does not work for US based users.
Dev environment info (please complete/provide the following information):
- Package version (stream-chat-react-native/stream-chat-expo): stream-chat-expo
- react-native or expo version: expo
- Device/Emulator (android/ios) and OS version: all
To Reproduce Steps to reproduce the behavior: Follow react-native tutorials at https://getstream.io/chat/react-native-chat/tutorial/#custom-preview . I think the problem is at https://github.com/GetStream/stream-chat-react-native/blob/master/src/components/ChannelPreview.js#L89
Expected behavior Allow clients to specify the date format.
@familywiser1 thanks for brining this up. We will add a props to customize date format!!
@familywiser1 this has been published - v0.6.3
You can use the prop formatLatestMessageDate in ChannelPreviewMessenger component.
Please let us know if it works for you :)
@vishalnarkhede - Sorry, this may be a dumb question but how do I pass props to ChannelPreviewMessenger?
This is how I am using ChannelList
<ChannelList
filters={filters}
sort={sort}
options={options}
Preview={ChannelPreviewMessenger}/>
@familywiser1 this has been published - v0.6.3
You can use the prop
formatLatestMessageDateinChannelPreviewMessengercomponent.Please let us know if it works for you :)
Hi @vishalnarkhede - Thanks so much for fixing it so quickly. I will really appreciate if you can let me know how to pass props to ChannelPreviewMessenger. This is how I am using ChannelList
<ChannelList
filters={filters}
sort={sort}
options={options}
Preview={ChannelPreviewMessenger}/>
I am not how to pass custom props to ChannelPreviewMessenger. Any code example or link to documentation would be really helpful
@familywiser1 Here's what I suggest trying:
<ChannelList
filters={filters}
sort={sort}
options={options}
Preview={(props) => <ChannelPreviewMessenger
formatLatestMessageDate={(date) => moment(date).toISOString()}
{...props}
/>
}
/>