fix crash on rrule.between returned bad dates #3256 (#3257)

Fixes: #3256 

BUT.. the testcase is inconclusive.. as the code FAILS without the fix,
BUT somehow RETURNS 0 entries..
in real life run the node helper fails, and all calendar processing
stops.
This commit is contained in:
sam detweiler
2023-11-07 12:48:00 -06:00
committed by GitHub
parent 296df06c21
commit b300191609
5 changed files with 82 additions and 1 deletions

View File

@@ -0,0 +1,29 @@
global.moment = require("moment-timezone");
const CalendarFetcherUtils = require("../../../../../modules/default/calendar/calendarfetcherutils");
describe("Calendar fetcher utils test", () => {
const defaultConfig = {
excludedEvents: []
};
describe("filterEvents", () => {
it("no events, not crash", () => {
const minusOneHour = moment().subtract(1, "hours").toDate();
const minusTwoHours = moment().subtract(2, "hours").toDate();
const plusOneHour = moment().add(1, "hours").toDate();
const plusTwoHours = moment().add(2, "hours").toDate();
const filteredEvents = CalendarFetcherUtils.filterEvents(
{
pastEvent: { type: "VEVENT", start: minusTwoHours, end: minusOneHour, summary: "pastEvent" },
ongoingEvent: { type: "VEVENT", start: minusOneHour, end: plusOneHour, summary: "ongoingEvent" },
upcomingEvent: { type: "VEVENT", start: plusOneHour, end: plusTwoHours, summary: "upcomingEvent" }
},
defaultConfig
);
expect(filteredEvents.length).toEqual(0);
});
});
});