Thank you both - that works perfectly. On the second item, is there a way to show the day of the week for a future date such as 12/25/2024 (which day Christmas falls on)?
Hi, still loving this set of macro’s and have a small question.
Why would one not import all macro’groups’ at once, instead of only the ones needed, is this performance related?
it was probably me figuring I am overdoing things here.
Have this bigger template: with all sorts of attributes, and this month, day combo could be added there, and next use it in a template-entity-row card, where I currently do this:
card:
type: custom:template-entity-row
entity: '[[entity]]'
name: >
{% set dagen = states(config.entity)|int(default=-1) %}
{% if dagen == 0 %}
{{state_attr(config.entity,'id')}} is vandaag:
{% else %}
{{state_attr(config.entity,'id')}} wordt {{state_attr(config.entity,'leeftijd')
|int(default=-1) + 1}} over:
{% endif %}
state: >
{% set dagen = states(config.entity)|int(default=-1) %}
{% if dagen == 0 %} Jarig!
{% else %} {{states(config.entity)}} {{'dag' if over == 1 else 'dagen'}}
{% endif %}
secondary: >
{% set event = state_attr(config.entity,'datum')|default(0,true)|as_datetime|as_local %}
{{state_attr(config.entity,'type')}}: {{event.strftime('%d-%m-%Y')}}
and only reference the config.entity
so I can use eg:
secondary: >
{% set event = state_attr(config.entity,'datum')|default(0,true)|as_datetime|as_local %}
{{state_attr(config.entity,'type')}}: {{event.strftime('%d-%m-%Y')}}
{% from 'easy_time.jinja' import weekday, month_day %}
op {{weekday((month_day(event.month,event.day)|as_datetime).isoweekday())}}
These macros look for timestamps, timestrings, timedeltas, or entity_ids. So you have to provide one of those. A small integer (in seconds) is not supported, well it is, but it assumes it’s a timestamp. 120 is 120 seconds past january 1st 1970, not exactly what you’d be looking for.
They sure do, like practically everything else in HA related to date, time and mathematical operations. What else would one use than a date/time related format?
Even if you have minutes or seconds, you can convert that to a timestamp and use it, or am I off here?
Sorry, not my best english-is-not-my-native-language-day…
I’m trying to learn Italian at the moment, and I can safely say it doesn’t make my english better… Not to talk about my native language German, getting a mix out of english, german and italian is mostly funny for others…