Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

use moment js in ejs file

var moment = require('moment');
var shortDateFormat = "ddd @ h:mmA"; // this is just an example of storing a date format once so you can change it in one place and have it propagate
app.locals.moment = moment; // this makes moment available as a variable in every EJS page
app.locals.shortDateFormat = shortDateFormat;
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #moment #js #ejs #file
ADD COMMENT
Topic
Name
9+6 =