Reputation: 185
I am trying to modify the value 7 in the following twig code:
{{ "now"|date_modify("+7 days")|date("Y/m/d") }}
The above works fine, but if I try this I get an error:
{{ "now"|date_modify("+" . user.days . " days")|date("Y/m/d") }}
Is it possible to edit the number of days dynamically in twig?
Upvotes: 1
Views: 424
Reputation: 5772
Try to use ~
to concatenate like this :
{{ "now"|date_modify("+" ~ user.days ~ " days")|date("Y/m/d") }}
Upvotes: 1