I have two objects in Twig:
{{ date }} is DateTime object{{ interval }} is DateInterval objectI need to show date with interval added. How can I use DateObject php function like add() with this two objects?
I can't do this on controller side, I need interval to date in twig. :(
You can use date_modify.
In your case, it would go as:
{{ yourDate|date_modify(yourInterval)|date("m/d/Y") }}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With