#Condition for date range? Is this correct?

1 messages · Page 1 of 1 (latest)

unreal spruce
#

Wondering if this is the correct format for a conditional template. The goal is to have the automation only trigger if during the months of January, February, or March.

This is what I pieced together from some posts I read online and chatgpt:
(might've been a bad call lol)

conditions:
  - condition: template
    value_template: >
      {% set n = now() %}
      {{ n.month in [7, 8, 9] }}

However when I save it and then reopen it to edit it again it automatically changes to this layout:

conditions:
  - condition: template
    value_template: |
      {% set n = now() %} {{ n.month in [7, 8, 9] }}

Are either of these even close and/or is there a more simple method?

fossil phoenix
unreal spruce
fossil phoenix
#

value_template: "{{ (now().month >=1) and (now().month <=3) }}"will be fine

#

you dont need to multiline it