I have a situation where I have a variable that is set to a number of weeks and I need to convert these weeks to total number of days, but can't seem to get things working: twigfiddle.com
Thanks, in advance!
{% set totalweeks = 7 Weeks %}
{% set totaldays = totalweeks | (days) %}
Output: {{totaldays}}
CodePudding user response:
You can do it this way, assuming your variable is a string which value is `"7 Weeks":
{% set totalweeks = '7 Weeks' %}
{% set totaldays = totalweeks|trim(' Weeks') * 7 %}
Output: {{totaldays}}
//49