Twig - Question

RPVBRPVB Member Posts: 11

Hello all,


Trying to get a Twig filter in the invoice template. But it's not giving the output I'm looking for. What am I doing wrong.


   <div class="col-xs-3">

    {% if customer.is_company %}

     <strong>{{ 'Vervaldatum' | t }}</strong><br />

     {{ now | date_modify("+14 days")| date("d-m-Y") }}

    {% endif %}

   </div>


The date_modify filter is not working correctly. But it is a standard twig filter.


The outcome is this picture below.


  <div class="col-xs-3">

    {% if customer.is_company %}

     <strong>{{ 'Vervaldatum' | t }}</strong><br />

     {{ now | date("d-m-Y") }}

    {% endif %}

   </div>


The one above is working fine. See result underneath.



2 comments

  • gregaricangregarican Member Posts: 901 

    Maybe try making it singular. That is, date_modify("+14 day"), and see if that works.

  • RPVBRPVB Member Posts: 11

    Hi Gregarican,

    Thanks for the input. But after some more testing it seams that this is the solution.


        {% if customer.is_company %}

         <strong>{{ 'Vervaldatum' | t }}</strong><br />

         {{ invoice.date_raw | date_modify("+14 days") | date('d-m-Y') }}

        {% endif %}



    I think that "invoice.date" or "now" variable is not the right format to work with the twig date_modify filter. If you use the invoice.date_raw field its working fine.

    Regards Remko

Sign In or Register to comment.