suddenly notice these 2 templates stopped doing their jib correctly:
remaining_days:
friendly_name: Remaining days
value_template: >
{% set this = now() %}
{% set next = this.month + 1 if this.month + 1 <= 12 else 1 %}
{% set last = this.replace(month=next, day=1) %}
{{(last.date() - this.date()).days}}
past_days:
friendly_name: Past days
value_template: >
{% set this = now() %}
{% set next = this.month + 1 if this.month + 1 <= 12 else 1 %}
{% set first = this.replace(day=1) %}
{{(this.date() - first.date()).days}}
this template used to show the remaining days of the current month did it, just as the other template shows the passed days of the current month, not passed and remaining days of the year?
found your original post on it
think I took out all the replace() myself in a later stage.
yes, you’re right again
good to stress these things, as they are fundamental to the calculations.
as for the passed days template, why did you add the next phrase there at all? Seems
{% set this = now() %}
{% set next = this.month + 1 if this.month + 1 <= 12 else 1 %}
{% set first = this.replace(day=1) %}
{{(this.date() - first.date()).days}}
can safely be replaced by:
{% set this = now() %}
{% set first = this.replace(day=1) %}
{{(this.date() - first.date()).days}}