title: Using Moment.js with Twig
body: <p>I am using <a href="http://momentjs.com/docs" rel="nofollow">Moment.js</a> with Twig for calculating Time ago,  </p>
  
  <p><strong>Code (Twig)</strong> -<br>
  I have date in <code>post_date_gmt</code> variable and i am using it like,</p>
  
  <pre><code>&lt;div class="time"&gt;
    &lt;time datetime="{{ post_date_gmt| date('Y-m-d H:i:s')}}"&gt;moment.unix({{ post_date_gmt }}).local().fromNow()&lt;/time&gt;
  &lt;/div&gt;  
  </code></pre>
  
  <p>This give me output :</p>
  
  <pre><code>&lt;div class="time"&gt;
      moment.unix(1331845445).local().fromNow()  
  &lt;/div&gt; 
  </code></pre>
  
  <p>When i try to run above string in console it worked fine - '<em>a month ago</em>'.<br>
  I don't understand why twig is not giving me the correct output?<br>
  Am i doing something wrong?. Thanks for your time.</p>