socket.on('addMess', function (data) {
// Форматирование времени
let msgDate = formatDate(data.time_mark)
let currentDate = formatDate(new Date())
var x = new Date(currentDate); // 1 Дата
var y = new Date(msgDate); // 2 Дата
if (Date.parse(x) == Date.parse(y)) {
console.log("=")
var Strtime = "Сегодня, в " + `${new Date(data.time_mark).getHours()}:${new Date(data.time_mark).getMinutes()}`
} else {
var date = new Date(el.time_mark); // 2009-11-10
var month = date.toLocaleString('default', { month: 'long' });
console.log(new Date(el.time_mark))
var Strtime = `${new Date(data.time_mark).getDay()} ${month} ${new Date(data.time_mark).getFullYear()} , в ${new Date(data.time_mark).getHours()}:${new Date(data.time_mark).getMinutes()}`
$("#msg-container").append(`
<div class="msg-box" id='${data.id}'>
<p class="author">${data.author}</p>
<p class="msg-text">${data.msg}</p>
<span class="time">${Strtime}</span>
</div>
`);
if (data.author != cred.nick) {
$(`#${data.id}`).addClass("not-my")
}
$("#all_mess").scrollTop($("#msg-container").height())
}
});
@Josa111,