Hey please don't shut me down right away because I don't know "the basics" or whatever, if I'm here actually posting it's because I've tried for 2 hours to do this simple thing and I legit can't and need help
I've used the top posts of this thread Javascript - sort objects in an array alphabetically on one property of the array and of a couple more too, it never sorts my array of objects, based on the property I'm pointing out, I don't know if I'm missing something or not this is what my array of objects looks like and I wanna sort them by the horaInicial property, which is a string that keeps an iso 8601
Array(3)
0: Appointment
area: "S. Eter"
data: "2019-05-23T12:40:55.155+01:00"
description: "Sprint CS WEB"
horaFinal: "2019-05-21T11:40:59.028Z"
horaInicial: "2019-05-21T11:40:59.028Z"
id: 17
__proto__: Object
1: Appointment
area: "S. Confiança"
data: "2019-05-23T12:40:55.155+01:00"
description: "AR"
horaFinal: "2019-05-21T16:45:15.448+01:00"
horaInicial: "2019-05-21T16:00:15.448+01:00"
id: 18
__proto__: Object
2: Appointment
area: "djdndjsnsnsnzznj"
data: "2019-05-23T11:18:24.596+01:00"
description: "xbxnxnsnsjsjdjdkssjdjsjsk"
horaFinal: "2019-05-22T10:42:46.770Z"
horaInicial: "2019-05-22T11:41:46.769+01:00"
id: 23
__proto__: Object
then I try sorting it with functions from the other thread, like:
this.appointments.sort(function(a, b) {
var textA = a.horaInicial.toUpperCase();
var textB = b.horaInicial.toUpperCase();
return (textA < textB) ? -1 : (textA > textB) ? 1 : 0;
});
console.log(this.appointments);
the appointments array comes out the same
What exactly am I missing?