Returning the next day closest to NOW
So I have a list of dates, and im trying to return the next date that is closest to
new Date.now();
Here is the code:
This doesnt work it returns :
This is my entire courseDate
array: https://bpa.st/NK6Q - as you can see there the closest date from now(2024-04-12T06:04:45.733Z
) should be the courseDate
with id: 21
.
Anyone know what it might be ? 🙂1 Reply
alright i figured it out, i had to do an
orderBy
on the from
column in ascending
order. can anyone confirm that this is the solution?