Skip to content
Advertisement

Select next object based on Date

I’m trying to Loop through an array and pull out the closest/next meeting object Chronologically.

Each object has a Start and End time but I want to know what is the current event OR the next event that’s going to happen. Failing that to get the last event.

e.g.

JavaScript

This is what i have so far:

JavaScript

Advertisement

Answer

Try this function getMeeting(meetings,targetDate)

You can pass the set of meetings + a target Date/defaults to now

JavaScript
User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement