I am currently working on a booking application project. I want to sort the itineraries created based on their time range, does anyone know how to sort multiple ranges of time in javascript/jquery?
For example, I have the ff. range of time (Each range should be considered as one object, I think?);
1:01 pm - 5:00 pm,
7:00 am - 8:00 am,
10:01 am - 1:00 pm,
8:01 am - 10:00 am,
I am planning to have a button to sort it from earliest to latest.
Something like this;
7:00 am - 8:00 am,
8:01 am - 10:00 am,
10:01 am - 1:00 pm,
1:01 pm - 5:00 pm
I haven't tried anything yet because I really don't know where to start. I am hoping to get the idea on how it works. Thank you in advance.
I did some research about this and I only found these How to sort an array of objects with jquery or javascript, What is the best way to parse a time into a Date object from user input in Javascript?. I am getting the idea on how to sort time because of this, but I don't know how to apply this on range of time.
As I have said, I really don't know where to start so I haven't considered whether it is an array or object, yet. It may be either one of them, I just need to know the idea on how it works. Thanks!