emersion / go-ical

An iCalendar library for Go
MIT License
52 stars 10 forks source link

Add helper to parse RRULE prop #9

Closed WhyNotHugo closed 2 years ago

WhyNotHugo commented 2 years ago

This relies on rrule-go, which implements RRULEs logic itself. The helper merely returns an ROption object.

See the inline documentation for Props.ROption for finer details.

emersion commented 2 years ago

Potential follow-up improvements:

WhyNotHugo commented 2 years ago

Add a function which parses RRULE, DTSTART and exclusion rules, and returns a single rrule.Set

I will likely follow-up with it since I'll eventually need it. I just need to re-read the relevant bits of the RFC t make sure I don't miss anything.

On another subject: There seems to be a bit of duplication between Prop.DateTime and Props.DateTime and others. Is one preferred and the other deprecated, or do they have distinct use cases?

emersion commented 2 years ago

On another subject: There seems to be a bit of duplication between Prop.DateTime and Props.DateTime and others. Is one preferred and the other deprecated, or do they have distinct use cases?

They are distinct use-cases: Props.DateTime is useful when there's only a single prop with the supplied name. ical supports multiple props with the same name, in which case callers need to use Prop.DateTime. In the RFC, see "The following […] MAY occur more than once" in the ABNF.

WhyNotHugo commented 2 years ago

Ah, makes sense.

So RecurrenceRule is definitely in the right place. :)