Bug with date verification

Hi,

I’ve been trying to make a verification of 2 dates in an if-statement.
As long as the date that has been filled in is still in September (I guess same month as now_plus7) , no issues. Verification works as it should. Once I select a day in October, verification fails.

Simplified version of the code:

{% assign now_plus7 = "now" as:date | advance_day: 7 | date:"%d/%m/%Y" %}
{% input period.custom.date.date as:date %}

Date1: {{ now_plus7 }} (today +7 days)
Date2: {{ period.custom.date.date }}

{% if period.custom.date.date < now_plus7 %}Date1 bigger{% else %}Date2 bigger{% endif %}

Is there something wrong with the code? I’m almost certain it used to work properly which makes me think it’s not related to the code but rather a bug.

Thanks in advance for your insights.

Hi @Gianluca,

Thanks for this clearly explained question and code snippet.

I had a look at your simplified code and indeed this does not seem to behaving as expected. I’ll check this further internally, and come back to you as soon as I receive any feedback.

Keep you posted!

Kind regards,
Robin

1 Like

Hi @Gianluca,

You cannot use the date filter when creating a local var (i.e. now_plus7) .

If you remove this date filter (date:"%d/%m/%Y") it will work fine. Filters should only be used for presentation purposes.

Hope this resolves your issue!

Kind regards,
Robin

It’s working, thanks!