I have a question about Moment js. I have a chat window and need to compare currentMessage.dateCreated and previousMessage.dateCreated. And if the difference between them is more then 15 minutes, I need to add a Flag/Label -> if(minutes > 15){ flag = true}).
How am I supposed to do compare minutes in chat messages with different values for dateCreated(not hardcoded)? Thank you for your answers!!!
let currentMessage = moment
.utc(conversationMessages[this.index].createdDate)
.local()
.format("D/MM/YYYY HH:mm:ss"); // returns "8/10/2020 14:08:28"
let previousMessage = moment
.utc(conversationMessages[this.index - 1].createdDate)
.local()
.format("D/MM/YYYY HH:mm:ss"); // returns "8/10/2020 13:06:31"