Commit f2f8eabca1f3e135e2c457e948e049f23ca798ff

Stephen Moloney 2016-03-10T23:13:07

upgrade to calendar 13.2, also fix potential calendar 13.2 bug

diff --git a/lib/hubic/openstack_api/cache.ex b/lib/hubic/openstack_api/cache.ex
index aac5e68..e56e030 100644
--- a/lib/hubic/openstack_api/cache.ex
+++ b/lib/hubic/openstack_api/cache.ex
@@ -167,6 +167,11 @@ defmodule ExOvh.Hubic.OpenstackApi.Cache do
 
   defp to_seconds(iso_time) do
     {:ok, expiry_ndt, offset} = Calendar.NaiveDateTime.Parse.iso8601(iso_time)
+    offset =
+    case offset do
+      :nil -> 0
+      offset -> offset
+    end
     {:ok, expiry_dt_utc} = Calendar.NaiveDateTime.with_offset_to_datetime_utc(expiry_ndt, offset)
     {:ok, now} = Calendar.DateTime.from_erl(:calendar.universal_time(), "UTC")
     {:ok, seconds, _microseconds, _when} = Calendar.DateTime.diff(expiry_dt_utc, now)
diff --git a/lib/ovh/openstack_api/webstorage/cache.ex b/lib/ovh/openstack_api/webstorage/cache.ex
index 3f9620c..049d93f 100644
--- a/lib/ovh/openstack_api/webstorage/cache.ex
+++ b/lib/ovh/openstack_api/webstorage/cache.ex
@@ -271,6 +271,11 @@ defmodule ExOvh.Ovh.OpenstackApi.Webstorage.Cache do
 
   defp to_seconds(iso_time) do
     {:ok, expiry_ndt, offset} = Calendar.NaiveDateTime.Parse.iso8601(iso_time)
+    offset =
+    case offset do
+      :nil -> 0
+      offset -> offset
+    end
     {:ok, expiry_dt_utc} = Calendar.NaiveDateTime.with_offset_to_datetime_utc(expiry_ndt, offset)
     {:ok, now} = Calendar.DateTime.from_erl(:calendar.universal_time(), "UTC")
     {:ok, seconds, _microseconds, _when} = Calendar.DateTime.diff(expiry_dt_utc, now)
diff --git a/mix.exs b/mix.exs
index 9068a8e..58d9a63 100644
--- a/mix.exs
+++ b/mix.exs
@@ -29,7 +29,7 @@ defmodule ExOvh.Mixfile do
       {:poison, "~> 1.0"},
       {:secure_random, "~> 0.2"},
       {:floki, "~> 0.7.1"},
-      {:calendar, "~> 0.12.4"},
+      {:calendar, "~> 0.13.2"},
       {:og, "~> 0.0", only: :dev},
       {:earmark, "~> 0.2.1", only: :dev},
       {:ex_doc,  "~> 0.11", only: :dev}