Theo's Typesafe CultTTC
Theo's Typesafe Cult2y ago
14 replies
Noor

How to sort object based on time (HH:MM)

Hey everyone, I have an object as below
const arr =[
{
id: 123,
time: "10:58"
}, {
id: 727,
time: "16:00"
}, {
id: 343,
time: "10:12"
},
...
]

I want to sort this array based on time, like whichever object has earlier time should be above than the object which has time later.
Was this page helpful?