As I work on developing a schedule app, it is necessary to sort items by both date and time simultaneously. In the current setup, the filtering only considers hours and minutes which is functional, but there is a need to also include dates in the sorting process.
The dates are stored in the database in the format YYYY-MM-DD, while the time is stored as separate values for hours and minutes, such as hours:"08", minutes:"25".
this.ord3ref.on("child_added", data => {
this.ord3.push({
key: data.key,
data: data.val()
});
this.ord3.sort(
(a, b) => a.data.hours - b.data.hours || a.data.minutes - b.data.minutes
);
});
https://i.sstatic.net/qCaF5.png https://i.sstatic.net/sFvwi.png
While the current sorting method is based on hours and minutes as shown in the image, it is essential to prioritize sorting by dates first, followed by hours and minutes.