Skip to content

Commit 1a745cf

Browse files
Fix issue 3393 (#3395)
Fix for #3393
1 parent 90ff340 commit 1a745cf

File tree

5 files changed

+77
-0
lines changed

5 files changed

+77
-0
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ _This release is scheduled to be released on 2024-04-01._
3939
- [newsfeed] Fix newsfeed stall issue introduced by #3336 (#3361)
4040
- Changed `log.debug` to `log.log` in `app.js` where logLevel is not set because config is not loaded at this time (#3353)
4141
- added message in case where config.js is missing the module.export line PR #3383
42+
- Fixed an issue where recurring events could extend past their recurrence end date (#3393)
4243

4344
### Deleted
4445

modules/default/calendar/calendarfetcherutils.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -311,6 +311,12 @@ const CalendarFetcherUtils = {
311311
arr[index] = new Date(date.valueOf() + oneDayInMs);
312312
}
313313
});
314+
// Adjusting the dates could push it beyond the 'until' date, so filter those out here.
315+
if (rule.options.until !== null) {
316+
dates = dates.filter((date) => {
317+
return date.valueOf() <= rule.options.until.valueOf();
318+
});
319+
}
314320
}
315321

316322
// The dates array from rrule can be confused by DST. If the event was created during DST and we
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
let config = {
2+
timeFormat: 12,
3+
4+
modules: [
5+
{
6+
module: "calendar",
7+
position: "bottom_bar",
8+
config: {
9+
hideDuplicates: false,
10+
maximumEntries: 100,
11+
calendars: [
12+
{
13+
maximumEntries: 100,
14+
maximumNumberOfDays: 1, // Just today
15+
url: "http://localhost:8080/tests/mocks/rrule_until.ics"
16+
}
17+
]
18+
}
19+
}
20+
]
21+
};
22+
23+
Date.now = () => {
24+
return new Date("07 Mar 2024 10:38:00 GMT-07:00").valueOf();
25+
};
26+
27+
/*************** DO NOT EDIT THE LINE BELOW ***************/
28+
if (typeof module !== "undefined") {
29+
module.exports = config;
30+
}

tests/electron/modules/calendar_spec.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,22 @@ describe("Calendar module", () => {
4444
});
4545
});
4646

47+
/****************************/
48+
// RRULE TESTS:
49+
// Add any tests that check rrule functionality here.
50+
describe("rrule", () => {
51+
it("Issue #3393 recurrence dates past rrule until date", async () => {
52+
await helpers.startApplication("tests/configs/modules/calendar/rrule_until.js", "07 Mar 2024 10:38:00 GMT-07:00", ["js/electron.js"], "America/Los_Angeles");
53+
expect(global.page).not.toBeNull();
54+
const loc = await global.page.locator(".calendar .event");
55+
const elem = loc.first();
56+
await elem.waitFor();
57+
expect(elem).not.toBeNull();
58+
const cnt = await loc.count();
59+
expect(cnt).toBe(1);
60+
});
61+
});
62+
4763
/****************************/
4864
// LOS ANGELES TESTS:
4965
// In 2023, DST (GMT-7) was until 5 Nov, after which is standard (STD) (GMT-8) time.

tests/mocks/rrule_until.ics

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
BEGIN:VEVENT
2+
DTSTART;TZID=America/Los_Angeles:20240229T160000
3+
DTEND;TZID=America/Los_Angeles:20240229T190000
4+
RRULE:FREQ=WEEKLY;WKST=MO;UNTIL=20240307T075959Z;BYDAY=TH
5+
DTSTAMP:20240307T180618Z
6+
CREATED:20231231T000501Z
7+
LAST-MODIFIED:20231231T005623Z
8+
SEQUENCE:2
9+
STATUS:CONFIRMED
10+
SUMMARY:My event
11+
TRANSP:OPAQUE
12+
END:VEVENT
13+
BEGIN:VEVENT
14+
DTSTART;TZID=America/Los_Angeles:20240307T160000
15+
DTEND;TZID=America/Los_Angeles:20240307T190000
16+
RRULE:FREQ=WEEKLY;WKST=MO;UNTIL=20240316T065959Z;BYDAY=TH
17+
DTSTAMP:20240307T180618Z
18+
CREATED:20231231T000501Z
19+
LAST-MODIFIED:20231231T005623Z
20+
SEQUENCE:3
21+
STATUS:CONFIRMED
22+
SUMMARY:My event
23+
TRANSP:OPAQUE
24+
END:VEVENT

0 commit comments

Comments
 (0)