mirror of
				https://github.com/karl0ss/homepage.git
				synced 2025-11-04 00:10:57 +00:00 
			
		
		
		
	Enhancement: better handle recurring events poorly handled by ical library (#4807)
This commit is contained in:
		
							parent
							
								
									0fd4ac17cd
								
							
						
					
					
						commit
						1dd5a9e1b0
					
				@ -51,9 +51,10 @@ export default function Integration({ config, params, setEvents, hideErrors, tim
 | 
				
			|||||||
        title = `${config.name}: ${title}`;
 | 
					        title = `${config.name}: ${title}`;
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      const eventToAdd = (date, i, type) => {
 | 
					 | 
				
			||||||
      // 'dtend' is null for all-day events
 | 
					      // 'dtend' is null for all-day events
 | 
				
			||||||
      const { dtstart, dtend = { value: 0 } } = event;
 | 
					      const { dtstart, dtend = { value: 0 } } = event;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					      const eventToAdd = (date, i, type) => {
 | 
				
			||||||
        const days = dtend.value === 0 ? 1 : (dtend.value - dtstart.value) / (1000 * 60 * 60 * 24);
 | 
					        const days = dtend.value === 0 ? 1 : (dtend.value - dtstart.value) / (1000 * 60 * 60 * 24);
 | 
				
			||||||
        const eventDate = timezone ? DateTime.fromJSDate(date, { zone: timezone }) : DateTime.fromJSDate(date);
 | 
					        const eventDate = timezone ? DateTime.fromJSDate(date, { zone: timezone }) : DateTime.fromJSDate(date);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -72,7 +73,13 @@ export default function Integration({ config, params, setEvents, hideErrors, tim
 | 
				
			|||||||
        }
 | 
					        }
 | 
				
			||||||
      };
 | 
					      };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      const recurrenceOptions = event?.recurrenceRule?.origOptions;
 | 
					      let recurrenceOptions = event?.recurrenceRule?.origOptions;
 | 
				
			||||||
 | 
					      // RRuleSet does not have dtstart, add it manually
 | 
				
			||||||
 | 
					      if (event?.recurrenceRule && event.recurrenceRule.rrules && event.recurrenceRule.rrules()?.[0]?.origOptions) {
 | 
				
			||||||
 | 
					        recurrenceOptions = event.recurrenceRule.rrules()[0].origOptions;
 | 
				
			||||||
 | 
					        recurrenceOptions.dtstart = dtstart.value;
 | 
				
			||||||
 | 
					      }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      if (recurrenceOptions && Object.keys(recurrenceOptions).length !== 0) {
 | 
					      if (recurrenceOptions && Object.keys(recurrenceOptions).length !== 0) {
 | 
				
			||||||
        try {
 | 
					        try {
 | 
				
			||||||
          const rule = new RRule(recurrenceOptions);
 | 
					          const rule = new RRule(recurrenceOptions);
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user