Hi,
I’m trying work out if a month within a financial period is earlier than the current period, but seem to be struggling with the use of the <
and >
signs in my equations.
For example, to create a simple illustration, I can recognise when a financial period month is equal to the current period month with the following code:
{% stripnewlines %}
|-10%-|-10%-|-10%-|-70%-+
{% newline %}
|**{% t "Month end" %}**
|**{% t "Period end" %}**
|**{% t "Test" %}**
|{% comment %}spacer{% endcomment %}
{% for month in period.month_end_dates %}
{% newline %}
{% assign month_end = month | date:'%B %Y' %}
{% assign period_end = period.end_date | date: '%B %Y' %}
|{{month_end}}
|{{period_end}}
|{% if month_end == period_end %}
{% assign check_ind = 0 %}
{% unexplained check_ind as:indicator%}
{% else %}
{% endif %}
|{% comment %}spacer{% endcomment %}
{% endfor %}
{% endstripnewlines %}
This will provide a table similar to the following, which will show what the current period is:
However, if I want to also identify all earlier periods (and therefore simply change my month_end == period_end
to month_end <= period_end
), I get the following result:
Is there something I am missing / am I being naive with my calculation?! Any help would be greatly appreciated.
Many thanks
Joe
Edit: Formatting of code