msg.data.forEach(el => {
// Форматирование времени
let msgDate = formatDate(el.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(el.time_mark).getHours()}:${new Date(el.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(el.time_mark).getDay()} ${month} ${new Date(el.time_mark).getFullYear()} , в ${new Date(el.time_mark).getHours()}:${new Date(el.time_mark).getMinutes()}`
}
$("#msg-container").append(`
<div class="msg-box" id='${el.id}'>
<p class="author">${el.nick}</p>
<p class="msg-text">${el.content}</p>
<span class="time">${Strtime}</span>
</div>
`);
if(el.nick != cred.nick){
$(`#${el.id}`).addClass("not-my")
}
});
$("#all_mess").scrollTop($("#msg-container").height())
}