Skip to content
This repository has been archived by the owner on Aug 15, 2020. It is now read-only.

How to capture events for a single day #44

Open
midzer opened this issue Jan 3, 2017 · 0 comments
Open

How to capture events for a single day #44

midzer opened this issue Jan 3, 2017 · 0 comments

Comments

@midzer
Copy link

midzer commented Jan 3, 2017

Hi all.
from parsed .ics data i want to extract events that happen on a specific day (when cycling through rendering of a monthly calendar for example).

This is what i tried:

var startDate = new Date(date); // specific day at 0:00
var endDate = new Date(startDate.getFullYear(), startDate.getMonth(), startDate.getDate(), 23, 59, 59);
var eventsInDay = [];
for (var i = 0; i < allEvents.length; i++) {
    if (allEvents[i].inTimeRange(startDate, endDate)) {
        eventsInDay.push(allEvents[i]);
    }
}

Miserably inTimeRange() returns true for all events on every day, although my recurring events only happen one time a month.

What is wrong with my implementation?

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

No branches or pull requests

1 participant