Giter Site home page Giter Site logo

rrule's Introduction

rrule

RRule is a go library for expanding iCalendar recurrence into actual instances. It provides parsing for recurrence rule text, modification and re-exporting to a string recurrence rule.

I was able to find libraries that did each of these features individually, but not one that did all three. Lucikly this RFC https://tools.ietf.org/html/rfc5545 makes it very clear how rrules work (along with a ton of examples).

The best way to understand how to use the library would be to look at the tests, I've implemented every example in the RFC as well as some others that I created from real world problems I've run into.

GoDoc: https://godoc.org/github.com/graham/rrule

Parsing from string

	rule_checker, err := rrule.Parse(
		"DTSTART;TZID=America/New_York:19970902T090000\n"+
			"RRULE:FREQ=DAILY;COUNT=10",
	)

Recurrence Rule to String

	fmt.Println( rule.String() )

Iterating through instances

	rule_checker, err := rrule.Parse(
		"DTSTART;TZID=America/New_York:19970902T090000\n"+
			"RRULE:FREQ=DAILY;COUNT=10",
	)

	iter := rule.Iterator()

	for iter.Step(&event) {
		fmt.Println(event)
	}

Questions and Contributions

If you find a bug, please file an issue, or propose a change, I'd be happy to include changes if you find a case I haven't covered.

This was a great opportunity for me to learn about the iCalendar standard, but ergonomically the library could be easier to use (expecially more examples). Recommendations welcome.

In terms of events themselves, I tried to ensure the core rrule library didn't have any dependencies to in the wild implementations (Google Calendar for example).

I have, however, started an example application under eventexpander that should correctly output event instances if given a Google Calendar event json object. As of 2019-08-10 I'm still working on this, but if you're interested in an actual implementation I'd recommend taking a look at that code.

Have a great day :)

rrule's People

Contributors

bynov avatar graham avatar julianooi avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

rrule's Issues

Panic when BYDAY has a '+' symbol

Panic when BYDAY has the '+' symbol

Tested with the following
"RRULE:FREQ=MONTHLY;INTERVAL=1;BYDAY=+1WE"

panic: Unknown Day
github.com/graham/[email protected]/lib.go:96

Expected: Not panic, and '+' symbol is ignored (remove symbol while still maintaining offset_dir in lib.go:380)

needs license

Hi @graham -- what license should we assume for this package? godoc won't show the docs because there's no LICENSE file, and I'd also like to be able to make some contributions myself.

Would prefer MIT or GPL, but that's just my vote.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.