Fix with ical convert to zone (#2377)
Co-authored-by: Omar López <zomars@me.com> Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
This commit is contained in:
		
							parent
							
								
									f8b7e17fda
								
							
						
					
					
						commit
						9d512e70c4
					
				
					 1 changed files with 8 additions and 4 deletions
				
			
		|  | @ -248,12 +248,16 @@ export default abstract class BaseCalendarService implements Calendar { | |||
|         const vcalendar = new ICAL.Component(jcalData); | ||||
|         const vevent = vcalendar.getFirstSubcomponent("vevent"); | ||||
|         const event = new ICAL.Event(vevent); | ||||
|         const timezoneComp = vcalendar.getFirstSubcomponent("vtimezone"); | ||||
|         const tzid: string = timezoneComp?.getFirstPropertyValue("tzid") ?? "UTC"; | ||||
|         const vtimezone = vcalendar.getFirstSubcomponent("vtimezone"); | ||||
|         if (vtimezone) { | ||||
|           const zone = new ICAL.Timezone(vtimezone); | ||||
|           event.startDate = event.startDate.convertToZone(zone); | ||||
|           event.endDate = event.endDate.convertToZone(zone); | ||||
|         } | ||||
| 
 | ||||
|         return { | ||||
|           start: dayjs.tz(event.startDate.toJSDate(), tzid).toISOString(), | ||||
|           end: dayjs.tz(event.endDate.toJSDate(), tzid).toISOString(), | ||||
|           start: dayjs(event.startDate.toJSDate()).toISOString(), | ||||
|           end: dayjs(event.endDate.toJSDate()).toISOString(), | ||||
|         }; | ||||
|       }); | ||||
| 
 | ||||
|  |  | |||
		Loading…
	
		Reference in a new issue
	
	 alannnc
						alannnc