diff --git a/lib/plausible_web/views/layout_view.ex b/lib/plausible_web/views/layout_view.ex index ec2bb57da..bba14ea7b 100644 --- a/lib/plausible_web/views/layout_view.ex +++ b/lib/plausible_web/views/layout_view.ex @@ -55,11 +55,15 @@ defmodule PlausibleWeb.LayoutView do end end + def on_grace_period?(nil), do: false + def on_grace_period?(user) do user.grace_period && Timex.diff(user.grace_period.end_date, Timex.today(), :days) >= 0 end + def grace_period_over?(nil), do: false + def grace_period_over?(user) do user.grace_period && Timex.diff(user.grace_period.end_date, Timex.today(), :days) < 0