Skip to content

Commit cf52ae6

Browse files
committed
dont display last ago, but day of month for message blocks
1 parent bae418d commit cf52ae6

File tree

1 file changed

+11
-5
lines changed
  • frontend/src/components/app/matches

1 file changed

+11
-5
lines changed

frontend/src/components/app/matches/Chat.vue

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
<div v-if="message.first_in_timespan"
2020
v-bind:class="{'text-center': true, 'mx-auto': true, 'mt-8': index !== 0}">
2121
<h1
22-
class="text-xs font-light inline-block rounded-md bg-gray-200 px-2 py-1">{{message.timestamp_ago}}</h1>
22+
class="text-xs font-light inline-block rounded-md bg-gray-200 px-2 py-1">{{message.timestamp_first}}</h1>
2323
</div>
2424
<MessageBubble
2525
v-bind:loggedInUserId="loggedInUserId"
@@ -61,16 +61,22 @@ export default {
6161
determineFirstMessagesOfTimespans(messages) {
6262
const len = messages.length;
6363
for (let i = 0; i < len; i += 1) {
64-
if (this.displayDate(messages[i].timestamp_ago)) {
64+
if (this.displayDate(messages[i].timestamp)) {
6565
messages[i].first_in_timespan = true;
66+
messages[i].timestamp_first = this.getDayMonthday(messages[i].timestamp);
6667
} else {
6768
messages[i].first_in_timespan = false;
6869
}
6970
}
7071
},
71-
displayDate(messageAgo) {
72-
if (messageAgo !== this.latestMessagesDate) {
73-
this.latestMessagesDate = messageAgo;
72+
getDayMonthday(timestamp) {
73+
const splitBySpace = timestamp.split(' ');
74+
return `${splitBySpace[0]} ${splitBySpace[1]} ${splitBySpace[2]}`;
75+
},
76+
displayDate(timestamp) {
77+
const dayMonthday = this.getDayMonthday(timestamp);
78+
if (dayMonthday !== this.latestMessagesDate) {
79+
this.latestMessagesDate = dayMonthday;
7480
return (1);
7581
}
7682
return (0);

0 commit comments

Comments
 (0)