mangony-hbs-helpers
Version:
Handlebars helpers used by Mangony
22 lines (20 loc) • 431 B
JavaScript
/**
* Represents a helper to display dates.
*
* @author Sebastian Fitzner
*/
const moment = require('moment');
module.exports = date;
module.exports.register = function (Handlebars) {
Handlebars.registerHelper('now', date);
};
/**
* Returns the date of now in a format you like by using momentJS.
*
* @param {String} format - Date format
*
* @return String
*/
function date(format) {
return moment().format(format);
}