From 65be7d6972054c811bf14972b902c0056956887d Mon Sep 17 00:00:00 2001 From: Alejandro Mataloni Date: Tue, 31 May 2016 11:21:36 -0300 Subject: [PATCH] [#120584573] fix user expiration date --- mix.exs | 6 ------ web/models/user.ex | 9 ++++++--- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/mix.exs b/mix.exs index c0337ec..3f08c62 100644 --- a/mix.exs +++ b/mix.exs @@ -49,10 +49,4 @@ defmodule CredoServer.Mixfile do {:exrm, "~> 1.0.5"} ] end - - defp description do - """ - This is a service to check public github PRs with credo syntax tool - """ - end end diff --git a/web/models/user.ex b/web/models/user.ex index c1a75b3..7e6ee4f 100644 --- a/web/models/user.ex +++ b/web/models/user.ex @@ -149,9 +149,12 @@ defmodule CredoServer.User do SecureRandom.uuid end + # Get tomorrow as the new expiration date defp new_expiration_date do - now = Ecto.DateTime.utc - %Ecto.DateTime{day: now.day + 1, hour: now.hour, min: now.min, - month: now.month, sec: now.sec, year: now.year} + :calendar.universal_time + |> :calendar.datetime_to_gregorian_seconds + |> +(60 * 60 * 24) + |> :calendar.gregorian_seconds_to_datetime + |> Ecto.DateTime.from_erl end end