I\'m using Jade to render my views from within Express.js. I am saving documents in MongoDB and using Mongoose to access my documents. I am saving a default date created when a
My solution is:
Add momentjs to your express application locals like this:
app.locals.moment = require('moment');
Then you can use moment in any jade files:
span='(Created at: ' + moment(obj.createTime).format("YYYY/MM/DD") + ')'
Reference: Making use of utility libraries in server-side Jade templates