go-ical
Work with ical formatted data in Go
WARNING
This repository has been moved to github.com/lestrrat-go/ical. This repository exists so that libraries pointing to this URL will keep functioning, but this repository will NOT be updated in the future. Please use the new import path.
DESCRIPTION
This is partially a port of Data::ICal (perl5 module) to Go.
Parse an ics file:
import "github.com/lestrrat/go-ical"
// snip...
p := ical.NewParser()
c, err := p.ParseFile(file)
// snip
for e := range c.Entries() {
ev, ok := e.(*ical.Event)
if !ok {
continue
}
// work with event.
}
Programatically generate a Calendar
import "github.com/lestrrat/go-ical"
// snip...
c := ical.New()
c.AddProperty("X-Foo-Bar-Baz", "value")
tz := ical.NewTimezone()
tz.AddProperty("TZID", "Asia/Tokyo")
c.AddEntry(tz)
ical.NewEncoder(os.Stdout).Encode(c)