vikunja-api/vendor/github.com/laurent22/ical-go/calendar_event.go

52 lines
917 B
Go
Raw Permalink Normal View History

2019-05-22 19:48:48 +02:00
package ical
import (
"time"
)
type CalendarEvent struct {
2019-05-24 19:45:33 +02:00
Id string
Summary string
Description string
Location string
URL string
CreatedAtUTC *time.Time
2019-05-22 19:48:48 +02:00
ModifiedAtUTC *time.Time
2019-05-24 19:45:33 +02:00
StartAt *time.Time
EndAt *time.Time
2019-05-22 19:48:48 +02:00
}
func (this *CalendarEvent) StartAtUTC() *time.Time {
return inUTC(this.StartAt)
}
func (this *CalendarEvent) EndAtUTC() *time.Time {
return inUTC(this.EndAt)
}
func (this *CalendarEvent) Serialize() string {
buffer := new(strBuffer)
return this.serializeWithBuffer(buffer)
}
func (this *CalendarEvent) ToICS() string {
return this.Serialize()
}
func (this *CalendarEvent) serializeWithBuffer(buffer *strBuffer) string {
serializer := calEventSerializer{
2019-05-24 19:45:33 +02:00
event: this,
2019-05-22 19:48:48 +02:00
buffer: buffer,
}
return serializer.serialize()
}
func inUTC(t *time.Time) *time.Time {
if t == nil {
return nil
}
tUTC := t.UTC()
return &tUTC
}