Cocktail.Builder.ICalendar (Cocktail v0.9.0) View Source

Build iCalendar format strings from schedules.

TODO: write long description

Link to this section Summary

Functions

Builds an iCalendar format string representation of a Cocktail.Schedule.t/0.

Link to this section Functions

Specs

Builds an iCalendar format string representation of a Cocktail.Schedule.t/0.

Examples

iex> alias Cocktail.Schedule
...> start_time = Timex.to_datetime(~N[2017-01-01 06:00:00], "America/Los_Angeles")
...> schedule = Schedule.new(start_time)
...> schedule = Schedule.add_recurrence_rule(schedule, :daily, interval: 2, hours: [10, 12])
...> build(schedule)
"DTSTART;TZID=America/Los_Angeles:20170101T060000\nRRULE:FREQ=DAILY;INTERVAL=2;BYHOUR=10,12"

iex> alias Cocktail.Schedule
...> schedule = Schedule.new(~N[2017-01-01 06:00:00])
...> schedule = Schedule.add_recurrence_rule(schedule, :daily, until: ~N[2017-01-31 11:59:59])
...> build(schedule)
"DTSTART:20170101T060000\nRRULE:FREQ=DAILY;UNTIL=20170131T115959"

iex> alias Cocktail.Schedule
...> schedule = Schedule.new(~N[2017-01-01 06:00:00])
...> schedule = Schedule.add_recurrence_rule(schedule, :daily, count: 3)
...> build(schedule)
"DTSTART:20170101T060000\nRRULE:FREQ=DAILY;COUNT=3"