Detaysoft / react-chat-elements

Reactjs chat elements chat UI, react chat components

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Translate message date

luisfuertes opened this issue · comments

commented

I have been looking for how to translate the date of messages such as "Just now" but I have only seen the prop: "dateString"

This works if the message is always at a fixed time, but if for example I want to put the "Just now" in other languages, I can use the same library that I have seen you use, "Timeago.js" and create a locale to translate it into Spanish for example. But since it appears as a string in the list, the value is not updated and even if 3 hours have passed since the message was written, the text will continue to be "Just now" or the one assigned to it in the message in the list as "dateString"

I think that for this to work correctly instead of "dateString" the prop should be "dateFormat" and be able to pass it the function that formats the desired date.

Is this correct or am I making a mistake about how to change the language in which the dates are displayed?