From 7b4a9321a81a47e6cf248df81e3d2320a2b7a68c Mon Sep 17 00:00:00 2001 From: Tony Stork Date: Mon, 1 May 2023 22:45:09 -0400 Subject: [PATCH] Improved macros for telling current time from input_datetime entities --- custom_templates/time.jinja | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/custom_templates/time.jinja b/custom_templates/time.jinja index 3b6f891..d603fd9 100644 --- a/custom_templates/time.jinja +++ b/custom_templates/time.jinja @@ -3,11 +3,15 @@ {% endmacro %} {% macro current_time_12hr() %} -{{ now().strftime("%I:%M %p") }} +{{ now().strftime("%-I:%M %p") }} {% endmacro %} {% macro input_datetime_12hr(entity) %} -{{ state_attr(entity,'timestamp') | int | timestamp_custom('%I:%M %p', False) }} +{{ state_attr(entity,'timestamp') | int | timestamp_custom('%-I:%M %p', False) }} +{% endmacro %} + +{% macro input_datetime_12hr_with_date(entity) %} +{{ state_attr(entity,'timestamp') | int | timestamp_custom('%-I:%M %p') }} {% endmacro %} {% macro current_date_readout() %}