How can I call the 'time_diff' function In Twig
The code
{{ post.created_at|time_diff }}
Output
The filter "time_diff" does not exist
How can I call the 'time_diff' function In Twig
The code
{{ post.created_at|time_diff }}
Output
The filter "time_diff" does not exist
I suggest You to use the KnpTimeBundle
So you can simply compare with the current date:
This compare with the another date:
The translation is enabled by default, simply review the translations files or add as you need.
Hope this help
If you're using Symfony 2,
And want to use some of the native twig extension
You have to declare as service something like :
At first you need:
Then you need to register Date extension:
After that you could use time_diff filter. All in docs
Did you add the date extension?
Add the following line before using this formatting: