summaryrefslogtreecommitdiff
path: root/lib/lsg_web/views/layout_view.ex
diff options
context:
space:
mode:
Diffstat (limited to 'lib/lsg_web/views/layout_view.ex')
-rw-r--r--lib/lsg_web/views/layout_view.ex7
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/lsg_web/views/layout_view.ex b/lib/lsg_web/views/layout_view.ex
index b28d3c5..41c5341 100644
--- a/lib/lsg_web/views/layout_view.ex
+++ b/lib/lsg_web/views/layout_view.ex
@@ -60,11 +60,14 @@ defmodule LSGWeb.LayoutView do
now_last_week = {y, w-1}
now_last_roll = 7-Timex.days_to_beginning_of_week(now)
+ date_date = DateTime.to_date(date)
+ now_date = DateTime.to_date(date)
+
format = cond do
date.year != now.year -> "{D}/{M}/{YYYY} {h24}:{m}"
- date.day == now.day -> "{h24}:{m}"
+ date_date == now_date -> "{h24}:{m}"
(now_week == date_week) || (date_week == now_last_week && (Date.day_of_week(date) >= now_last_roll)) -> "{WDfull} {h24}:{m}"
- (now.month == date.month) -> "{WDfull} {D} {h24}:{m}"
+ (now.year == date.year && now.month == date.month) -> "{WDfull} {D} {h24}:{m}"
true -> "{WDfull} {D} {M} {h24}:{m}"
end