I am building a website using create-react-app and I need to get the upcoming time from the list as compared to the current time.
my time list is
let times = [
{
time: "05:33",
},
{
time: "12:20",
},
{
time: "15:23",
},
{
time: "17:46",
},
{
time: "19:08",
},
];
I have tried many solutions but all in vain, one solution that is also unsuccessful is
const compareTime = moment().format("hh:mm");
time7.map((item, i) => {
console.log(
Date.parse(
`01/01/2011 ${format(parse(item.time, "HH:mm", new Date()), "hh:mm")}45`
) > Date.parse(`01/01/2011 ${compareTime}:10`)
);
});
I am super stuck in this and trying to solve this problem for almost a week I need a proper solution to get the upcoming time from the list any kind of help will be appreciated.