File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -29,7 +29,28 @@ const fetchIcal = async () => {
2929
3030 const _tmp = [];
3131 for (let k in cal ) _tmp .push (cal [k ]);
32- const events = _tmp .filter ((ev ) => ev .type == ' VEVENT' && ev .start && ev .start > now );
32+
33+ const events: CalendarComponent [] = [];
34+ _tmp .forEach ((ev ) => {
35+ if (ev .type !== ' VEVENT' || ! ev .start ) return ;
36+
37+ if (ev .rrule ) {
38+ // Expand the recurring events for the next 90 days
39+ const limit = new Date (now .getTime () + 90 * 24 * 60 * 60 * 1000 );
40+ const dates = ev .rrule .between (now , limit , true );
41+ dates .forEach ((date ) => {
42+ const clone = { ... ev };
43+ clone .start = date ;
44+ if (ev .end ) {
45+ const duration = ev .end .getTime () - ev .start .getTime ();
46+ clone .end = new Date (date .getTime () + duration );
47+ }
48+ events .push (clone );
49+ });
50+ } else if (ev .start > now ) {
51+ events .push (ev );
52+ }
53+ });
3354
3455 // If there are no upcoming events, show one from the past
3556 if (events .length == 0 ) {
You can’t perform that action at this time.
0 commit comments