upgrade to calendar 13.2, also fix potential calendar 13.2 bug
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45
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}