Display date of message if not the same as today.
This commit is contained in:
@@ -81,9 +81,14 @@ export default {
|
|||||||
},
|
},
|
||||||
getTime: function(timestamp) {
|
getTime: function(timestamp) {
|
||||||
let date = new Date(timestamp);
|
let date = new Date(timestamp);
|
||||||
return `${this.pad(date.getHours())}:${this.pad(
|
const timeString = `${this.pad(date.getHours())}:${this.pad(
|
||||||
date.getMinutes()
|
date.getMinutes()
|
||||||
)}:${this.pad(date.getSeconds())}`;
|
)}:${this.pad(date.getSeconds())}`;
|
||||||
|
|
||||||
|
if (date.getDate() == new Date().getDate()) {
|
||||||
|
return timeString;
|
||||||
|
}
|
||||||
|
return `${date.toLocaleDateString()} ${timeString}`
|
||||||
},
|
},
|
||||||
sendMessage: function() {
|
sendMessage: function() {
|
||||||
this.$emit("message", this.message);
|
this.$emit("message", this.message);
|
||||||
|
|||||||
Reference in New Issue
Block a user