ICalendar.Util.Deserialize.to_date

You're seeing just the function to_date, go back to ICalendar.Util.Deserialize module for more information.
Link to this function

to_date(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.Util.Deserialize.to_date("19930407T153022Z")
...> Timex.to_erl(date)
{{1993, 4, 7}, {15, 30, 22}}

As well as the future:

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

And should return error for incorrect dates:

iex> ICalendar.Util.Deserialize.to_date("1993/04/07")
{:error, "Expected `2 digit month` at line 1, column 5."}

It should handle timezones from the Olson Database:

iex> {:ok, date} = ICalendar.Util.Deserialize.to_date("19980119T020000",
...> %{"TZID" => "America/Chicago"})
...> [Timex.to_erl(date), date.time_zone]
[{{1998, 1, 19}, {2, 0, 0}}, "America/Chicago"]