Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Get currently running events #9

Open
sumbbl145 opened this issue Dec 7, 2018 · 5 comments
Open

Get currently running events #9

sumbbl145 opened this issue Dec 7, 2018 · 5 comments

Comments

@sumbbl145
Copy link

Is there an ability to get currently running events, perhaps with IcalExpander.now()?

things now() would catch for all events (including recurring):

  • events running all day for that day
  • events running at that particular time (startDate <= now() && endDate >= now())
@mifi
Copy link
Owner

mifi commented Dec 20, 2018

Shouldn't be too hard to implement! PR welcome :)

@paustint
Copy link

paustint commented Jan 18, 2019

Wouldn't this be solved by passing the same date for start/end times?

Example:

const events = icalExpander.between(
   new Date(),
   new Date()
);

Existing code seems to cover the use-case (as also depicted in the diagram in the README)

// After and before are just the params passed in to between(before, after)
    function isEventWithinRange(startTime, endTime) {
      return (!after || endTime >= after.getTime()) &&
      (!before || startTime <= before.getTime());
    }

@mifi
Copy link
Owner

mifi commented Jan 27, 2019

Could be! Someone 🙈 just needs to write some tests to verify all scenarios (time after, time before, time within event, full day)

@radarfox
Copy link

Here is an another idea, that would also cover my use-case of finding the events at the specific date and time:

at(date) {
  return this.between(date, date);
}

now() {
  return this.at(new Date());
}

@mifi
Copy link
Owner

mifi commented Apr 24, 2020

Sure. PR welcome!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants