const arr = [
{id:0, text: "text", date: "2021-05-14T16:29:46.000Z"},
{id:1, text: "text 2", date: "2021-05-14T17:29:46.000Z"},
{id:1, text: "text 3", date: "2021-06-14T17:29:46.000Z"},
]
const groupArr = {}
arr.map(message => ({...message, date: new Date(message.date)}))
.sort((m1, m2) => m1.date - m2.date)
.forEach(message => {
const date = message.date.toISOString().split('T')[0]
if (!groupArr.hasOwnProperty(date)) {
groupArr[date] = []
}
groupArr[date].push(message)
})
Object.keys(groupArr).forEach(key => console.log(groupArr[key]))