vobject v0.5.0 ICalendar.Decoder View Source

Link to this section Summary

Functions

This function extracts parameter data from a key in an iCalendar string

This function is designed to parse iCal datetime strings into erlang dates

This function should strip any sanitization that has been applied to content within an iCal string

Link to this section Functions

Link to this function parse_type(val, atom, params) View Source
Link to this function parse_val(val, spec, params) View Source

This function extracts parameter data from a key in an iCalendar string.

iex> ICalendar.Decoder.retrieve_params(
...>   "DTSTART;TZID=America/Chicago")
["DTSTART", %{tzid: "America/Chicago"}]

It should be able to handle multiple parameters per key:

iex> ICalendar.Decoder.retrieve_params(
...>   "KEY;LOREM=ipsum;DOLOR=sit")
["KEY", %{lorem: "ipsum", dolor: "sit"}]
Link to this function to_datetime(date_string, map) View Source

This function is designed to parse iCal datetime strings into erlang dates.

It should be able to handle dates from the past:

iex> {:ok, date} = ICalendar.Decoder.to_datetime("19930407T153022Z")
...> Timex.to_erl(date)
{{1993, 4, 7}, {15, 30, 22}}

As well as the future:

iex> {:ok, date} = ICalendar.Decoder.to_datetime("39930407T153022Z")
...> Timex.to_erl(date)
{{3993, 4, 7}, {15, 30, 22}}

And should return error for incorrect dates:

iex> ICalendar.Decoder.to_datetime("1993/04/07")
{:error, :invalid_format}

It should handle timezones from the Olson Database:

iex> {:ok, date} = ICalendar.Decoder.to_datetime("19980119T020000",
...> %{tzid: "America/Chicago"})
...> [Timex.to_erl(date), date.time_zone]
[{{1998, 1, 19}, {2, 0, 0}}, "America/Chicago"]
Link to this function to_time(time_string, map) View Source

This function should strip any sanitization that has been applied to content within an iCal string.

iex> ICalendar.Decoder.unescape(~s(lorem\\, ipsum))
"lorem, ipsum"