Answers.Body: <p>The Twig extension package is not included with your Craft install. So you need to <a href="https://github.com/twigphp/Twig-extensions" rel="nofollow">download</a> it and add it to your Craft plugin manually.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-02-18T12:12:53.307Z
Answers.LastActivityDate: 2015-02-18T12:12:53.307Z
Answers.UserDisplayName: carlcs
Body: <p>Is it possible to activate the following Twig extension from within a craft plugin:</p>
  
  <p><a href="http://twig.sensiolabs.org/doc/extensions/date.html" rel="nofollow">http://twig.sensiolabs.org/doc/extensions/date.html</a></p>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2015-02-18T12:16:18.730Z
Comments.Text: If the `time_diff` filter is all you need, then maybe it's worth looking into this Craft plugin with similar functionality: ["Time Ago In Words"](https://github.com/blue-mantis/BM-Time-Ago-In-Words).
Comments.UserDisplayName: carlcs
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2015-02-18T12:22:11.570Z
Comments.Text: How did I miss that?! Perfect, I will need to extend functionality a tad as I also need to return the actual difference values in years, months and days too.
Comments.UserDisplayName: Sam Hibberd
Tags: <templating><plugins>
Title: How do you add a core twig extension in plugins using addTwigExtension()?
ThreadText: # How do you add a core twig extension in plugins using addTwigExtension()?
  
  (Asked by: username_0 on 2015-02-18)
  
  Is it possible to activate the following Twig extension from within a craft plugin:
  
  <http://twig.sensiolabs.org/doc/extensions/date.html>
  
  **Tags:** templating, plugins
  
  > **Comments:**
  > **username_1**: If the `time_diff` filter is all you need, then maybe it's worth looking into this Craft plugin with similar functionality: ["Time Ago In Words"](https://github.com/blue-mantis/BM-Time-Ago-In-Words).  
  > **username_0**: How did I miss that?! Perfect, I will need to extend functionality a tad as I also need to return the actual difference values in years, months and days too.  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2015-02-18. Score: 1
  
  The Twig extension package is not included with your Craft install. So you need to [download](https://github.com/twigphp/Twig-extensions) it and add it to your Craft plugin manually.
  
  
  ---
  
  