   def to_erl(%Date{}), do: {:error, :unsupported_calendar}
 
   @doc """
-  Converts an Erlang date tuple (like those produced by the `:calendar` module) to a `Date` struct.
+  Converts an Erlang date tuple to a `Date` struct.
 
   Attempting to convert an invalid ISO calendar date will produce an error tuple.
 

      iex> NaiveDateTime.from_erl({{2000, 13, 1},{13, 30, 15}})
      {:error, :invalid_date}
  """
  @spec from_erl(:calendar.datetime(), Calendar.microsecond) :: {:ok, __MODULE__.t} | {:error, atom}
  def from_erl({{year, month, day}, {hour, minute, second}}, microsecond \\ 0) do
    new(year, month, day, hour, minute, second, microsecond)
  end
end


  end

  @doc """
  Parses the extended "Date and time of day" format described by ISO8601:2004.

  Raises it the format is invalid.

  ## Examples

      iex> NaiveDateTime.from_iso8601!("2015-01-23T23:50:07.123Z")
      %NaiveDateTime{year: 2015, month: 01, day: 23, hour: 23, minute: 50, second: 07, microsecond: 123000}
      iex> NaiveDateTime.from_iso8601!("2015-01-23P23:50:07")
      ** (ArgumentError) cannot parse "2015-01-23P23:50:07" as naive date time, reason: :invalid_format

  """
  @spec from_iso8601!(String.t) :: NaiveDateTime.t | no_return
  def from_iso8601!(string) do
    case from_iso8601(string) do
      {:ok, value} ->
        value
      {:error, reason} ->
        raise ArgumentError, "cannot parse #{inspect string} as naive date time, reason: #{inspect reason}"
    end
  end

  @doc """
  Converts the given naive date time to ISO8601.

  Only supports converting naive date times which are in the ISO calendar,
