const info = [{
"userID" : "aaa",
"dob" : "2021-07-23 22:30:00.000Z" <--- String
},
{
"userID" : "aaa11",
"dob" : "2021-06-10 12:30:00.000Z" <--- String
},
{
"userID" : "aaa22",
"dob" : "2021-09-23 22:30:00.000Z" <--- String
}]
I've been using sort to rearrange the list. However, I am quite stuck, sorting with the string.
info.sort((a, b) => a.dob - b.dob);
This works with the number but does not work with the string. I've been trying to look for the answer here, however, I could not figure it out how to sort with the ISO date
string. How can I do this?