I'd like to sort these ChatListItems by the date of chat.messages.date. 
{
    userChats.map(chat => (
        <ChatLink key={chat._id} to={`/chats/${chat._id}`}>
            <ChatListItem
                partnerName={pickPartnerName(
                    userName,
                    chat.userName1,
                    chat.userName2
                )}
                userImgSrc={DefaultUserAvatar}
                lastMessage={chat.messages[chat.messages.length - 1].body}
                lastMessageDate={chat.messages[
                    chat.messages.length - 1
                ].date.slice(11, 16)}
            />
        </ChatLink>
    ));
}
The db object looks like this:
const messageSchema = new mongoose.Schema({
    type: {
        type: String
    },
    body: {
        type: String
    },
    author: {
        type: String
    },
    date: {
        type: Date,
        default: Date.now
    }
});
const chatSchema = new mongoose.Schema({
    userName1: String,
    userName2: String,
    messages: [messageSchema]
});
So i would like to sort by the last date of these messages. the dates itself look like this: 2020-01-13 22:22:17.345Z
How would i accomplish this?
thanks in advance!
Sorry for my horrble question title
Here's a visual of what i'm actually trying to achieve. https://i.stack.imgur.com/zQkxl.png
 
    