       ~T[23:00:07]
 
   """
-  @spec to_time(t) :: Time.t
-  def to_time(%NaiveDateTime{hour: hour, minute: minute, second: second, microsecond: microsecond, calendar: calendar}) do
-    %Time{hour: hour, minute: minute, second: second, microsecond: microsecond, calendar: calendar}
+  @spec to_time(t) :: Time.t()
+  def to_time(%NaiveDateTime{} = naive_datetime) do
+    %NaiveDateTime{
+      hour: hour,
+      minute: minute,
+      second: second,
+      microsecond: microsecond,
+      calendar: calendar
+    } = naive_datetime
+
+    %Time{
+      hour: hour,
+      minute: minute,
+      second: second,
+      microsecond: microsecond,
+      calendar: calendar
+    }
   end
 
   @doc """

                           hour: 13, minute: 30, second: 15, microsecond: {0, 0}}}

  """
  @spec convert(Calendar.naive_datetime, Calendar.calendar) :: {:ok, t} | {:error, :incompatible_calendars}
  def convert(%{calendar: calendar, year: year, month: month, day: day,
                hour: hour, minute: minute, second: second, microsecond: microsecond}, calendar) do
    {:ok, %NaiveDateTime{calendar: calendar, year: year, month: month, day: day,
                         hour: hour, minute: minute, second: second, microsecond: microsecond}}
  end

  def convert(%{calendar: ndt_calendar, microsecond: {_, precision}} = naive_datetime, calendar) do

      {:error, :invalid_format}

  """
  @spec from_iso8601(String.t(), Calendar.calendar()) :: {:ok, t} | {:error, atom}
  def from_iso8601(string, calendar \\ Calendar.ISO)

  def from_iso8601(
        <<
          year::4-bytes,
          ?-,
          month::2-bytes,
          ?-,
          day::2-bytes,
          sep,
          hour::2-bytes,
          ?:,
          min::2-bytes,
          ?:,
          sec::2-bytes,
          rest::binary
        >>,
        calendar
      )
      when sep in [?\s, ?T] do
    with {year, ""} <- Integer.parse(year),
         {month, ""} <- Integer.parse(month),
         {day, ""} <- Integer.parse(day),
