mirror of
https://gitlab.dit.htwk-leipzig.de/htwk-software/htwkalender-pwa.git
synced 2025-08-03 18:29:16 +02:00
Merge branch 'main' into 11-enhanced-module-titles
# Conflicts: # backend/model/eventModel.go # backend/service/fetch/fetchSeminarEventService.go
This commit is contained in:
@@ -9,7 +9,7 @@ import (
|
||||
"github.com/jordic/goics"
|
||||
)
|
||||
|
||||
// local type for EmitICal function
|
||||
// IcalModel local type for EmitICal function
|
||||
type IcalModel struct {
|
||||
Events model.Events
|
||||
Mapping []model.FeedCollection
|
||||
@@ -17,7 +17,7 @@ type IcalModel struct {
|
||||
|
||||
// EmitICal implements the interface for goics
|
||||
func (icalModel IcalModel) EmitICal() goics.Componenter {
|
||||
layout := "2006-01-02 15:04:05 -0700 MST"
|
||||
europeTime, _ := time.LoadLocation("Europe/Berlin")
|
||||
c := goics.NewComponent()
|
||||
c.SetType("VCALENDAR")
|
||||
c.AddProperty("VERSION", "2.0")
|
||||
@@ -29,11 +29,9 @@ func (icalModel IcalModel) EmitICal() goics.Componenter {
|
||||
for _, event := range icalModel.Events {
|
||||
s := goics.NewComponent()
|
||||
s.SetType("VEVENT")
|
||||
timeEnd, _ := time.Parse(layout, event.End)
|
||||
timeStart, _ := time.Parse(layout, event.Start)
|
||||
k, v := goics.FormatDateTime("DTEND;TZID=Europe/Berlin", timeEnd)
|
||||
k, v := goics.FormatDateTime("DTEND;TZID=Europe/Berlin", event.End.Time().Local().In(europeTime))
|
||||
s.AddProperty(k, v)
|
||||
k, v = goics.FormatDateTime("DTSTART;TZID=Europe/Berlin", timeStart)
|
||||
k, v = goics.FormatDateTime("DTSTART;TZID=Europe/Berlin", event.Start.Time().Local().In(europeTime))
|
||||
s.AddProperty(k, v)
|
||||
s.AddProperty("SUMMARY", replaceNameIfUserDefined(&event, icalModel.Mapping))
|
||||
s.AddProperty("DESCRIPTION", generateDescription(event))
|
||||
|
Reference in New Issue
Block a user