A few more time macros

This commit is contained in:
2023-05-03 18:09:41 -04:00
parent 2958c048ef
commit 45899df1c9

View File

@ -3,7 +3,15 @@
{% endmacro %}
{% macro current_time_12hr() %}
{{ now().strftime("%-I:%M %p") }}
{{ now().strftime('%-I:%M %p') }}
{% endmacro %}
{% macro current_time_24hr() %}
{{ now().strftime('%H:%M') }}
{% endmacro %}
{% macro current_date_input() %}
{{ now().strftime('%Y-%m-%d') }}
{% endmacro %}
{% macro input_datetime_12hr(entity) %}
@ -30,6 +38,10 @@
{{ as_timestamp(strptime(state_attr(calendar,start_or_end), '%Y-%m-%d %H:%M:%S')) | timestamp_custom("%I:%M %p") }}
{% endmacro %}
{% macro increment_datetime_from_now(hours) %}
{{ (as_timestamp(now()) + ((hours* 60) * 60)) | int | timestamp_custom('%Y-%m-%d %H:%M:%S') }}
{% endmacro %}
{% macro ct() %}
{{ ((now().hour * 60 + now().minute) * 60 ) }}
{% endmacro %}