https://github.com/lestrrat-go/ical
Work with ical formatted data
https://github.com/lestrrat-go/ical
Last synced: about 2 months ago
JSON representation
Work with ical formatted data
- Host: GitHub
- URL: https://github.com/lestrrat-go/ical
- Owner: lestrrat-go
- License: mit
- Created: 2016-10-20T06:39:08.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2020-12-29T07:05:49.000Z (over 4 years ago)
- Last Synced: 2024-06-19T00:25:15.005Z (about 1 year ago)
- Language: Go
- Homepage:
- Size: 41 KB
- Stars: 12
- Watchers: 3
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# ical
Work with ical formatted data in Go
[](https://travis-ci.org/lestrrat-go/ical)
[](https://godoc.org/github.com/lestrrat-go/ical)# DESCRIPTION
This is partially a port of Data::ICal (perl5 module) to Go.
Parse an ics file:
```go
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
```go
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)
```