MDL-65114 core_message: date format depends on message age

Messages sent today are displayed using 24 hour time, e.g. "14:21".
Older messages are displayed using the format, e.g. "31/01/2019".
This commit is contained in:
Jake Dallimore
2019-03-29 09:18:09 +08:00
parent 0920f35ed9
commit 51be3bf18d
3 changed files with 18 additions and 2 deletions
File diff suppressed because one or more lines are too long
@@ -202,6 +202,12 @@ function(
return formattedConversation;
});
formattedConversations.forEach(function(conversation) {
if (new Date().toDateString() == new Date(conversation.lastmessagedate * 1000).toDateString()) {
conversation.istoday = true;
}
});
return Templates.render(TEMPLATES.CONVERSATIONS_LIST, {conversations: formattedConversations})
.then(function(html) {
contentContainer.append(html);
@@ -456,6 +462,10 @@ function(
// Cache the conversation.
loadedConversationsById[conversation.id] = conversation;
if (new Date().toDateString() == new Date(formattedConversation.lastmessagedate * 1000).toDateString()) {
formattedConversation.istoday = true;
}
return Templates.render(TEMPLATES.CONVERSATIONS_LIST, {conversations: [formattedConversation]})
.then(function(html) {
var contentContainer = LazyLoadList.getContentContainer(root);