mirror of
https://gitlab.dit.htwk-leipzig.de/htwk-software/htwkalender.git
synced 2025-08-03 10:19:14 +02:00
feat:#31 updated database start end to date
This commit is contained in:
@@ -4,10 +4,9 @@ import (
|
||||
"github.com/jordic/goics"
|
||||
"htwkalender/model"
|
||||
"htwkalender/service/functions"
|
||||
"time"
|
||||
)
|
||||
|
||||
// local type for EmitICal function
|
||||
// IcalModel local type for EmitICal function
|
||||
type IcalModel struct {
|
||||
Events model.Events
|
||||
Mapping []model.FeedCollection
|
||||
@@ -15,7 +14,6 @@ type IcalModel struct {
|
||||
|
||||
// EmitICal implements the interface for goics
|
||||
func (icalModel IcalModel) EmitICal() goics.Componenter {
|
||||
layout := "2006-01-02 15:04:05 -0700 MST"
|
||||
c := goics.NewComponent()
|
||||
c.SetType("VCALENDAR")
|
||||
c.AddProperty("VERSION", "2.0")
|
||||
@@ -27,11 +25,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)
|
||||
s.AddProperty(k, v)
|
||||
k, v = goics.FormatDateTime("DTSTART;TZID=Europe/Berlin", timeStart)
|
||||
k, v = goics.FormatDateTime("DTSTART;TZID=Europe/Berlin", event.Start)
|
||||
s.AddProperty(k, v)
|
||||
s.AddProperty("SUMMARY", replaceNameIfUserDefined(event.Name, icalModel.Mapping))
|
||||
s.AddProperty("DESCRIPTION", generateDescription(event))
|
||||
|
Reference in New Issue
Block a user