From 5fffdb471f5e4d26355d0fb4a6600143e507da1f Mon Sep 17 00:00:00 2001 From: Georgi Gardev Date: Sun, 26 Jul 2020 13:40:03 +0300 Subject: [PATCH] Refactor greeting template --- config/templates/partials/greeting.yaml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/config/templates/partials/greeting.yaml b/config/templates/partials/greeting.yaml index 1c35de3..83e1ba4 100644 --- a/config/templates/partials/greeting.yaml +++ b/config/templates/partials/greeting.yaml @@ -1,8 +1,10 @@ >- - {%- if now().strftime('%H')|int < 12 and now().strftime('%H')|int > 6 -%} + {% let current_hour = now().strftime('%H')|int %} + + {%- if current_hour < 12 and current_hour > 6 -%} Good morning! - {%- elif now().strftime('%H')|int >= 12 and now().strftime('%H')|int < 17 -%} + {%- elif current_hour >= 12 and current_hour < 17 -%} Good afternoon! {%- else -%} Good evening!